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.
Inherited Members
Namespace: Egothor.Stemmer
Assembly: Lucene.Net.Analysis.Stempel.dll
Syntax
public class Trie
Constructors
| Improve this Doc View SourceTrie(IDataInput)
Constructor for the Trie object.
Declaration
public Trie(IDataInput is)
Parameters
| Type | Name | Description |
|---|---|---|
| J2N.IO.IDataInput | is | the input stream |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if an I/O error occurs |
Trie(Boolean)
Constructor for the Trie object.
Declaration
public Trie(bool forward)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | forward | set to |
Trie(Boolean, Int32, IList<String>, IList<Row>)
Constructor for the Trie object.
Declaration
public Trie(bool forward, int root, IList<string> cmds, IList<Row> rows)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | forward |
|
| System.Int32 | root | index of the row that is the root node |
| System.Collections.Generic.IList<System.String> | cmds | the patch commands to store |
| System.Collections.Generic.IList<Row> | rows | a Vector of Vectors. Each inner Vector is a node of this Trie |
Methods
| Improve this Doc View SourceAdd(String, String)
Add the given key associated with the given patch command. If either parameter is null this method will return without executing.
Declaration
public virtual void Add(string key, string cmd)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | the key |
| System.String | cmd | the patch command |
GetAll(String)
Gets the all attribute of the Trie object
Declaration
public virtual string[] GetAll(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | Description of the Parameter |
Returns
| Type | Description |
|---|---|
| System.String[] | The all value |
GetCells()
Return the number of cells in this Trie object.
Declaration
public virtual int GetCells()
Returns
| Type | Description |
|---|---|
| System.Int32 | the number of cells |
GetCellsPnt()
Gets the cellsPnt attribute of the Trie object
Declaration
public virtual int GetCellsPnt()
Returns
| Type | Description |
|---|---|
| System.Int32 | The cellsPnt value |
GetCellsVal()
Gets the cellsVal attribute of the Trie object
Declaration
public virtual int GetCellsVal()
Returns
| Type | Description |
|---|---|
| System.Int32 | The cellsVal value |
GetFully(String)
Return the element that is stored in a cell associated with the given key.
Declaration
public virtual string GetFully(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | the key |
Returns
| Type | Description |
|---|---|
| System.String | the associated element |
GetLastOnPath(String)
Return the element that is stored as last on a path associated with the given key.
Declaration
public virtual string GetLastOnPath(string key)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | key | the key associated with the desired element |
Returns
| Type | Description |
|---|---|
| System.String | the last on path element |
PrintInfo(TextWriter, String)
writes debugging info to the printstream
Declaration
public virtual void PrintInfo(TextWriter out, string prefix)
Parameters
| Type | Name | Description |
|---|---|---|
| System.IO.TextWriter | out | |
| System.String | prefix |
Reduce(Reduce)
Declaration
public virtual Trie Reduce(Reduce by)
Parameters
| Type | Name | Description |
|---|---|---|
| Reduce | by | the Trie to reduce |
Returns
| Type | Description |
|---|---|
| Trie | newly reduced Trie |
Store(IDataOutput)
Write this Trie to the given output stream.
Declaration
public virtual void Store(IDataOutput os)
Parameters
| Type | Name | Description |
|---|---|---|
| J2N.IO.IDataOutput | os | the output stream |
Exceptions
| Type | Condition |
|---|---|
| System.IO.IOException | if an I/O error occurs |