import Trie from 'causal-net/packages/causality-preprocessing/src/Tokenizer/trie.js'
Trie
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
root: * |
Method Summary
Public Methods | ||
public |
commonPrefixSearch(ss: *): * Returns an array of all tokens starting with ss. |
|
public |
findAllCommonPrefixes(ss: *, node: *, arr: *) Checks whether a node starts with ss. |
|
public |
insert(word: *, score: *, index: *) Inserts a token into the trie. |
Public Constructors
public constructor() source
Public Members
public root: * source
Public Methods
public commonPrefixSearch(ss: *): * source
Returns an array of all tokens starting with ss.
Params:
Name | Type | Attribute | Description |
ss | * | The prefix to match on. |
Return:
* |
public findAllCommonPrefixes(ss: *, node: *, arr: *) source
Checks whether a node starts with ss.
Params:
Name | Type | Attribute | Description |
ss | * | The prefix. |
|
node | * | The node currently being considered. |
|
arr | * | An array of the matching tokens uncovered so far. |
public insert(word: *, score: *, index: *) source
Inserts a token into the trie.
Params:
Name | Type | Attribute | Description |
word | * | ||
score | * | ||
index | * |