|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.egothor.stemmer.Trie
public class Trie
A Trie is used to store a dictionary of words and their stems.
Actually, what is stored are words with their respective patch commands. A trie can be termed forward (keys read from left to right) or backward (keys read from right to left). This property will vary depending on the language for which a Trie is constructed.
Constructor Summary | |
---|---|
Trie(boolean forward)
Constructor for the Trie object. |
|
Trie(boolean forward,
int root,
List<CharSequence> cmds,
List<Row> rows)
Constructor for the Trie object. |
|
Trie(DataInput is)
Constructor for the Trie object. |
Method Summary | |
---|---|
void |
add(CharSequence key,
CharSequence cmd)
Add the given key associated with the given patch command. |
CharSequence[] |
getAll(CharSequence key)
Gets the all attribute of the Trie object |
int |
getCells()
Return the number of cells in this Trie object. |
int |
getCellsPnt()
Gets the cellsPnt attribute of the Trie object |
int |
getCellsVal()
Gets the cellsVal attribute of the Trie object |
CharSequence |
getFully(CharSequence key)
Return the element that is stored in a cell associated with the given key. |
CharSequence |
getLastOnPath(CharSequence key)
Return the element that is stored as last on a path associated with the given key. |
void |
printInfo(CharSequence prefix)
|
Trie |
reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced Trie. |
void |
store(DataOutput os)
Write this Trie to the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Trie(DataInput is) throws IOException
is
- the input stream
IOException
- if an I/O error occurspublic Trie(boolean forward)
forward
- set to truepublic Trie(boolean forward, int root, List<CharSequence> cmds, List<Row> rows)
forward
- true if read left to right, false if read
right to leftroot
- index of the row that is the root nodecmds
- the patch commands to storerows
- a Vector of Vectors. Each inner Vector is a node of this TrieMethod Detail |
---|
public CharSequence[] getAll(CharSequence key)
key
- Description of the Parameter
public int getCells()
public int getCellsPnt()
public int getCellsVal()
public CharSequence getFully(CharSequence key)
key
- the key
public CharSequence getLastOnPath(CharSequence key)
key
- the key associated with the desired element
public void store(DataOutput os) throws IOException
os
- the output stream
IOException
- if an I/O error occurspublic void add(CharSequence key, CharSequence cmd)
key
- the keycmd
- the patch commandpublic Trie reduce(Reduce by)
by
- the Trie to reduce
public void printInfo(CharSequence prefix)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |