public class DictionaryBuilderIterative
extends java.lang.Object
This class is used to construct a dictionary in the form of a minimized
deterministic finite state automaton. This builder can create a normal
dictionary automaton (Dictionary
or a perfect hash automaton
(PerfectHashDictionary
).
The workflow is simple:
add(CharSequence)
.build()
or
buildPerfectHash()
.Construction of the automaton finalizes the build process - it is not possible to add new character sequences afterwards.
The following construction algorithm is used:
Incremental Construction of Minimal Acyclic Finite-State Automata, Jan Daciuk, Bruce W. Watson, Stoyan Mihov, and Robert E. Watson, 2000, Association for Computational Linguistics
Constructor and Description |
---|
DictionaryBuilderIterative()
Construct a
DictionaryBuilderIterative . |
Modifier and Type | Method and Description |
---|---|
DictionaryBuilderIterative |
add(java.lang.CharSequence seq)
Add a character sequence.
|
DictionaryBuilderIterative |
addAll(java.util.Collection<? extends java.lang.CharSequence> seqs)
Add all sequences from a lexicographically sorted collection.
|
eu.danieldk.dictomaton.Dictionary |
build()
Create a dictionary automaton.
|
eu.danieldk.dictomaton.PerfectHashDictionary |
buildPerfectHash()
Create a perfect hash automaton.
|
eu.danieldk.dictomaton.PerfectHashDictionary |
buildPerfectHash(boolean stateSuffixes) |
int |
compareCharacterSequences(java.lang.CharSequence seq1,
java.lang.CharSequence seq2) |
java.lang.String |
toDot()
Obtain a Graphviz dot representation of the automaton.
|
public DictionaryBuilderIterative()
DictionaryBuilderIterative
.public DictionaryBuilderIterative add(java.lang.CharSequence seq) throws eu.danieldk.dictomaton.DictionaryBuilderException
seq
- The sequence.eu.danieldk.dictomaton.DictionaryBuilderException
public int compareCharacterSequences(java.lang.CharSequence seq1, java.lang.CharSequence seq2)
public DictionaryBuilderIterative addAll(java.util.Collection<? extends java.lang.CharSequence> seqs) throws eu.danieldk.dictomaton.DictionaryBuilderException
seqs
- A collection of sequences.DictionaryBuilderException
public eu.danieldk.dictomaton.Dictionary build()
DictionaryBuilderIterative
.public eu.danieldk.dictomaton.PerfectHashDictionary buildPerfectHash()
DictionaryBuilderIterative
.public eu.danieldk.dictomaton.PerfectHashDictionary buildPerfectHash(boolean stateSuffixes)
public java.lang.String toDot()
DictionaryBuilderIterative
.