Package opennlp.tools.tokenize
Class WordpieceEncoder.VocabularyTrie
java.lang.Object
opennlp.tools.tokenize.WordpieceEncoder.VocabularyTrie
- Enclosing class:
WordpieceEncoder
Finds vocabulary entries without creating strings for candidate lengths.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateVocabularyTrie(Map<String, Integer> vocabulary, boolean continuation) Indexes the initial or the continuation pieces of a vocabulary. -
Method Summary
Modifier and TypeMethodDescriptionprivate WordpieceEncoder.VocabularyMatchlongestMatch(char[] text, int from, int to) Returns the longest entry that starts atfrom.
-
Field Details
-
root
-
-
Constructor Details
-
VocabularyTrie
Indexes the initial or the continuation pieces of a vocabulary.- Parameters:
vocabulary- The piece-to-id mapping.continuation-trueto index pieces starting with the continuation prefix, stored without it;falseto index all other pieces.
-
-
Method Details
-
longestMatch
Returns the longest entry that starts atfrom.
-