Package org.egothor.stemmer
Class MultiTrie
java.lang.Object
org.egothor.stemmer.Trie
org.egothor.stemmer.MultiTrie
- Direct Known Subclasses:
MultiTrie2
The MultiTrie is a Trie of Tries. It stores words and their associated patch commands. The
MultiTrie handles patch commands individually (each command by itself).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(CharSequence key, CharSequence cmd) Add an element to this structure consisting of the given key and patch command.getFully(CharSequence key) Return the element that is stored in a cell associated with the given key.Return the element that is stored as last on a path belonging to the given key.voidprintInfo(PrintStream out, CharSequence prefix) Print the given prefix and the position(s) in the Trie where it appears.Remove empty rows from the given Trie and return the newly reduced Trie.voidstore(DataOutput os) Write this data structure to the given output stream.Methods inherited from class org.egothor.stemmer.Trie
getAll, getCells, getCellsPnt, getCellsVal
-
Constructor Details
-
MultiTrie
Constructor for the MultiTrie object.- Parameters:
is- the input stream- Throws:
IOException- if an I/O error occurs
-
MultiTrie
public MultiTrie(boolean forward) Constructor for the MultiTrie object- Parameters:
forward- set totrueif the elements should be read left to right
-
-
Method Details
-
getFully
Return the element that is stored in a cell associated with the given key. -
getLastOnPath
Return the element that is stored as last on a path belonging to the given key.- Overrides:
getLastOnPathin classTrie- Parameters:
key- the key associated with the desired element- Returns:
- the element that is stored as last on a path
-
store
Write this data structure to the given output stream.- Overrides:
storein classTrie- Parameters:
os- the output stream- Throws:
IOException- if an I/O error occurs
-
add
Add an element to this structure consisting of the given key and patch command.This method will return without executing if the
cmdparameter's length is 0.- Parameters:
key- the keycmd- the patch command
-
reduce
Remove empty rows from the given Trie and return the newly reduced Trie. -
printInfo
Print the given prefix and the position(s) in the Trie where it appears.
-