Package org.egothor.stemmer
Class MultiTrie2
- java.lang.Object
-
- org.egothor.stemmer.Trie
-
- org.egothor.stemmer.MultiTrie
-
- org.egothor.stemmer.MultiTrie2
-
public class MultiTrie2 extends MultiTrie
The MultiTrie is a Trie of Tries.It stores words and their associated patch commands. The MultiTrie handles patch commands broken into their constituent parts, as a MultiTrie does, but the commands are delimited by the skip command.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.egothor.stemmer.Trie
Trie.StrEnum
-
-
Constructor Summary
Constructors Constructor Description MultiTrie2(boolean forward)
Constructor for the MultiTrie2 objectMultiTrie2(java.io.DataInput is)
Constructor for the MultiTrie object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(java.lang.CharSequence key, java.lang.CharSequence cmd)
Add an element to this structure consisting of the given key and patch command.private boolean
cannotFollow(char after, char goes)
private int
dashEven(java.lang.CharSequence in, int from)
java.lang.CharSequence[]
decompose(java.lang.CharSequence cmd)
Break the given patch command into its constituent pieces.java.lang.CharSequence
getFully(java.lang.CharSequence key)
Return the element that is stored in a cell associated with the given key.java.lang.CharSequence
getLastOnPath(java.lang.CharSequence key)
Return the element that is stored as last on a path belonging to the given key.private int
lengthPP(java.lang.CharSequence cmd)
Trie
reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced Trie.private java.lang.CharSequence
skip(java.lang.CharSequence in, int count)
void
store(java.io.DataOutput os)
Write this data structure to the given output stream.-
Methods inherited from class org.egothor.stemmer.Trie
getAll, getCells, getCellsPnt, getCellsVal
-
-
-
-
Constructor Detail
-
MultiTrie2
public MultiTrie2(java.io.DataInput is) throws java.io.IOException
Constructor for the MultiTrie object.- Parameters:
is
- the input stream- Throws:
java.io.IOException
- if an I/O error occurs
-
MultiTrie2
public MultiTrie2(boolean forward)
Constructor for the MultiTrie2 object- Parameters:
forward
- set totrue
if the elements should be read left to right
-
-
Method Detail
-
getFully
public java.lang.CharSequence getFully(java.lang.CharSequence key)
Return the element that is stored in a cell associated with the given key.
-
getLastOnPath
public java.lang.CharSequence getLastOnPath(java.lang.CharSequence key)
Return the element that is stored as last on a path belonging to the given key.- Overrides:
getLastOnPath
in classMultiTrie
- Parameters:
key
- the key associated with the desired element- Returns:
- the element that is stored as last on a path
-
store
public void store(java.io.DataOutput os) throws java.io.IOException
Write this data structure to the given output stream.
-
add
public void add(java.lang.CharSequence key, java.lang.CharSequence cmd)
Add an element to this structure consisting of the given key and patch command.This method will return without executing if the
cmd
parameter's length is 0.
-
decompose
public java.lang.CharSequence[] decompose(java.lang.CharSequence cmd)
Break the given patch command into its constituent pieces. The pieces are delimited by NOOP commands.- Parameters:
cmd
- the patch command- Returns:
- an array containing the pieces of the command
-
reduce
public Trie reduce(Reduce by)
Remove empty rows from the given Trie and return the newly reduced Trie.
-
cannotFollow
private boolean cannotFollow(char after, char goes)
-
skip
private java.lang.CharSequence skip(java.lang.CharSequence in, int count)
-
dashEven
private int dashEven(java.lang.CharSequence in, int from)
-
lengthPP
private int lengthPP(java.lang.CharSequence cmd)
-
-