public static class SimpleVocabulary.VocabularyBuilder
extends java.lang.Object
SimpleVocabulary.| Modifier and Type | Field and Description |
|---|---|
protected int |
minFrequency |
protected java.util.Set<java.lang.String> |
reservedTokens |
protected java.util.List<java.util.List<java.lang.String>> |
sentences |
protected java.lang.String |
unknownToken |
| Constructor and Description |
|---|
VocabularyBuilder() |
| Modifier and Type | Method and Description |
|---|---|
SimpleVocabulary.VocabularyBuilder |
add(java.util.List<java.lang.String> sentence)
Adds the given sentence to the
SimpleVocabulary. |
SimpleVocabulary.VocabularyBuilder |
addAll(java.util.List<java.util.List<java.lang.String>> sentences)
Adds the given list of sentences to the
SimpleVocabulary. |
SimpleVocabulary |
build()
Builds the
SimpleVocabulary object with the set arguments. |
SimpleVocabulary.VocabularyBuilder |
optMinFrequency(int minFrequency)
Sets the optional parameter that specifies the minimum frequency to consider a token to
be part of the
SimpleVocabulary. |
SimpleVocabulary.VocabularyBuilder |
optReservedTokens(java.util.Collection<java.lang.String> reservedTokens)
Sets the optional parameter that sets the list of reserved tokens.
|
SimpleVocabulary.VocabularyBuilder |
optUnknownToken(java.lang.String unknownToken)
Sets the optional parameter that specifies the unknown token's string value.
|
protected java.util.List<java.util.List<java.lang.String>> sentences
protected java.util.Set<java.lang.String> reservedTokens
protected int minFrequency
protected java.lang.String unknownToken
public SimpleVocabulary.VocabularyBuilder optMinFrequency(int minFrequency)
SimpleVocabulary. Defaults to 10.minFrequency - the minimum frequency to consider a token to be part of the SimpleVocabularyVocabularyBuilderpublic SimpleVocabulary.VocabularyBuilder optUnknownToken(java.lang.String unknownToken)
unknownToken - the string value of the unknown tokenVocabularyBuilderpublic SimpleVocabulary.VocabularyBuilder optReservedTokens(java.util.Collection<java.lang.String> reservedTokens)
reservedTokens - the list of reserved tokensVocabularyBuilderpublic SimpleVocabulary.VocabularyBuilder add(java.util.List<java.lang.String> sentence)
SimpleVocabulary.sentence - the sentence to be addedVocabularyBuilderpublic SimpleVocabulary.VocabularyBuilder addAll(java.util.List<java.util.List<java.lang.String>> sentences)
SimpleVocabulary.sentences - the list of sentences to be addedVocabularyBuilderpublic SimpleVocabulary build()
SimpleVocabulary object with the set arguments.SimpleVocabulary object built