Class JaspellTernarySearchTrie
Implementation of a Ternary Search Trie, a data structure for storing
This data structure is faster than hashing for many typical search problems, and supports a broader range of useful problems and operations. Ternary searches are faster than hashing and more powerful, too.
The theory of ternary search trees was described at a symposium in 1997 (see "Fast Algorithms for Sorting and Searching Strings," by J.L. Bentley and R. Sedgewick, Proceedings of the 8th Annual ACM-SIAM Symposium on Discrete Algorithms, January 1997). Algorithms in C, Third Edition, by Robert Sedgewick (Addison-Wesley, 1998) provides yet another view of ternary search trees.
Inheritance
Assembly: Lucene.Net.Suggest.dll
Syntax
public class JaspellTernarySearchTrie : object
Constructors
Name | Description |
---|---|
JaspellTernarySearchTrie() | Constructs an empty Ternary Search Trie. |
JaspellTernarySearchTrie(CultureInfo) | Constructs an empty Ternary Search Trie,
specifying the |
JaspellTernarySearchTrie(FileInfo) | Constructs a Ternary Search Trie and loads data from a Uses the culture of the current thread to lowercase words before comparing. |
JaspellTernarySearchTrie(FileInfo, CultureInfo) | Constructs a Ternary Search Trie and loads data from a Uses the supplied culture to lowercase words before comparing. |
JaspellTernarySearchTrie(FileInfo, Boolean) | Constructs a Ternary Search Trie and loads data from a Uses the culture of the current thread to lowercase words before comparing. |
JaspellTernarySearchTrie(FileInfo, Boolean, CultureInfo) | Constructs a Ternary Search Trie and loads data from a Uses the supplied culture to lowercase words before comparing. |
Properties
Name | Description |
---|---|
MatchAlmostDiff | Sets the number of characters by which words can differ from target word when calling the MatchAlmost(String, Int32) method. Arguments less than 0 will set the char difference to 0, and arguments greater than 3 will set the char difference to 3.
|
NumReturnValues | Sets the default maximum number of values returned from the MatchPrefix(String, Int32) and MatchAlmost(String, Int32) methods. The value should be set this to -1 to get an unlimited number of return values. note that the methods mentioned above provide overloaded versions that allow you to specify the maximum number of return values, in which case this value is temporarily overridden. |
Methods
Name | Description |
---|---|
Get(String) | Retrieve the object indexed by a key. |
GetAndIncrement(String) | Retrieve the |
GetKey(JaspellTernarySearchTrie.TSTNode) | Returns the key that indexes the node argument. |
GetNode(String) | Returns the node indexed by key, or |
GetNode(String, JaspellTernarySearchTrie.TSTNode) | Returns the node indexed by key, or |
GetOrCreateNode(String) | Returns the node indexed by key, creating that node if it doesn't exist, and creating any required intermediate nodes if they don't exist. |
GetSizeInBytes() | Return an approximate memory usage for this trie. |
MatchAlmost(String) | Returns a If the MatchAlmost(String, Int32) method is called before the MatchAlmostDiff property has been called for the first time, then diff = 0.
|
MatchAlmost(String, Int32) | Returns a If the MatchAlmost(String, Int32) method is called before the MatchAlmostDiff property has been called for the first time, then diff = 0.
|
MatchPrefix(String) | Returns an alphabetical |
MatchPrefix(String, Int32) | Returns an alphabetical |
NumDataNodes() | Returns the number of nodes in the trie that have non-null data. |
NumDataNodes(JaspellTernarySearchTrie.TSTNode) | Returns the number of nodes in the subtrie below and including the starting node. The method counts only nodes that have non-null data. |
NumNodes() | Returns the total number of nodes in the trie. The method counts nodes whether or not they have data. |
NumNodes(JaspellTernarySearchTrie.TSTNode) | Returns the total number of nodes in the subtrie below and including the starting Node. The method counts nodes whether or not they have data. |
Put(String, Object) | Stores a value in the trie. The value may be retrieved using the key. |
Remove(String) | Removes the value indexed by key. Also removes all nodes that are rendered unnecessary by the removal of this data. |
SortKeys(JaspellTernarySearchTrie.TSTNode, Int32) | Returns keys sorted in alphabetical order. This includes the start Node and all nodes connected to the start Node. The number of keys returned is limited to numReturnValues. To get a list that isn't limited in size, set numReturnValues to -1.
|