Class doubletree.Trie
doubletree.Trie
This is the class for the specialized trie that is the data for doubletree.DoubleTree.
The Trie will get pieces of data that contain fields. Some (possibly all) of those fields will be used for distinguishing among items.
For example, we might have an "author" field, but not use it when distinguishing among items for the Trie.
Defined in: Trie.js.
Constructor Attributes | Constructor Name and Description |
---|---|
doubletree.Trie(caseSensitive, fldNames, fldDelim, distinguishingFldsArray, undistinguishedRoot)
|
Method Attributes | Method Name and Description |
---|---|
addNgram(itemArray, id, count)
Add an ngram to the Trie
|
|
deserialize(serialized)
make this Trie have the values of a previously serialized Trie see #serialize
|
|
get the distinguishing fields for the data
|
|
get the field delimiter for the data
|
|
get the field names in the data
|
|
get the unique root of this Trie.
|
|
serialize the Trie as a JSON string
|
|
toTree(filterFuns, descendentLevel)
convert the Trie to a tree structure for display.
|
Class Detail
doubletree.Trie(caseSensitive, fldNames, fldDelim, distinguishingFldsArray, undistinguishedRoot)
- Parameters:
- caseSensitive
- are the elements in the first distinguishing field compared in a case sensitive fashion
- fldNames
- the names of the fields
- fldDelim
- the field delimiter
- distinguishingFldsArray
- undistinguishedRoot
Method Detail
addNgram(itemArray, id, count)
Add an ngram to the Trie
- Parameters:
- itemArray
- an array of delimited items (the ngrams)
- id
- an id for this ngram
- count
- a count for this ngram. Default is 1
caseSensitive()
- Returns:
- whether this Trie uses case sensitive comparison
deserialize(serialized)
make this Trie have the values of a previously serialized Trie see #serialize
- Parameters:
- serialized
distinguishingFieldsArray()
get the distinguishing fields for the data
- Returns:
- the distinguishing fields for the data
fieldDelim()
get the field delimiter for the data
- Returns:
- the field delimiter for the data
fieldNames()
get the field names in the data
- Returns:
- the field names in the data
getUniqRoot()
get the unique root of this Trie. Used only by DoubleTree
- Returns:
- a new Trie with a unique item as the root
serialize()
serialize the Trie as a JSON string
- Returns:
- the JSON string representation of the Trie
toTree(filterFuns, descendentLevel)
convert the Trie to a tree structure for display. Used only by DoubleTree
- Parameters:
- filterFuns
- the filtering functions to apply to the tree see DoubleTree.filters
- descendentLevel
- the current level we are filtering
- Returns:
- the tree