public static class Vocabulary.VocabularyBuilder
extends java.lang.Object
Vocabulary
.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 |
---|---|
Vocabulary.VocabularyBuilder |
add(java.util.List<java.lang.String> sentence)
Adds the given sentence to the
Vocabulary . |
Vocabulary.VocabularyBuilder |
addAll(java.util.List<java.util.List<java.lang.String>> sentences)
Adds the given list of sentences to the
Vocabulary . |
Vocabulary |
build()
Builds the
Vocabulary object with the set arguments. |
Vocabulary.VocabularyBuilder |
optMinFrequency(int minFrequency)
Sets the optional parameter that specifies the minimum frequency to consider a token to
be part of the
Vocabulary . |
Vocabulary.VocabularyBuilder |
optReservedTokens(java.util.Collection<java.lang.String> reservedTokens)
Sets the optional parameter that sets the list of reserved tokens.
|
Vocabulary.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 Vocabulary.VocabularyBuilder optMinFrequency(int minFrequency)
Vocabulary
. Defaults to 10.minFrequency
- the minimum frequency to consider a token to be part of the Vocabulary
VocabularyBuilder
public Vocabulary.VocabularyBuilder optUnknownToken(java.lang.String unknownToken)
unknownToken
- the string value of the unknown tokenVocabularyBuilder
public Vocabulary.VocabularyBuilder optReservedTokens(java.util.Collection<java.lang.String> reservedTokens)
reservedTokens
- the list of reserved tokensVocabularyBuilder
public Vocabulary.VocabularyBuilder add(java.util.List<java.lang.String> sentence)
Vocabulary
.sentence
- the sentence to be addedVocabularyBuilder
public Vocabulary.VocabularyBuilder addAll(java.util.List<java.util.List<java.lang.String>> sentences)
Vocabulary
.sentences
- the list of sentences to be addedVocabularyBuilder
public Vocabulary build()
Vocabulary
object with the set arguments.Vocabulary
object built