ContextGraph constructor
ContextGraph(
- List<
List< tokenIds,int> > - List<
KeywordPhrase> phrases
Implementation
ContextGraph(List<List<int>> tokenIds, List<KeywordPhrase> phrases)
: root = ContextState(
token: -1,
tokenScore: 0,
nodeScore: 0,
outputScore: 0,
) {
if (tokenIds.isEmpty || tokenIds.length != phrases.length) {
throw ArgumentError('At least one tokenized phrase is required');
}
root.fail = root;
_build(tokenIds, phrases);
_fillFailureAndOutputLinks();
}