Class VocabConstructor.Builder<T extends SequenceElement>
- java.lang.Object
-
- org.deeplearning4j.models.word2vec.wordstore.VocabConstructor.Builder<T>
-
- Enclosing class:
- VocabConstructor<T extends SequenceElement>
public static class VocabConstructor.Builder<T extends SequenceElement> extends Object
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VocabConstructor.Builder<T>
addSource(@NonNull SequenceIterator<T> iterator, int minElementFrequency)
Adds SequenceIterator for vocabulary construction.VocabConstructor.Builder<T>
allowParallelTokenization(boolean reallyAllow)
VocabConstructor<T>
build()
VocabConstructor.Builder<T>
enableScavenger(boolean reallyEnable)
VocabConstructor.Builder<T>
fetchLabels(boolean reallyFetch)
Sets, if labels should be fetched, during vocab buildingVocabConstructor.Builder<T>
setEntriesLimit(int limit)
This method sets the limit to resulting vocabulary size.VocabConstructor.Builder<T>
setIndex(InvertedIndex<T> index)
VocabConstructor.Builder<T>
setLockFactor(boolean lockf)
VocabConstructor.Builder<T>
setStopWords(@NonNull Collection<String> stopWords)
VocabConstructor.Builder<T>
setTargetVocabCache(@NonNull VocabCache<T> cache)
After temporary internal vocabulary is built, it will be transferred to target VocabCache you pass hereVocabConstructor.Builder<T>
setUnk(T unk)
protected VocabConstructor.Builder<T>
useAdaGrad(boolean useAdaGrad)
Defines, if adaptive gradients should be created during vocabulary mastering
-
-
-
Method Detail
-
setEntriesLimit
public VocabConstructor.Builder<T> setEntriesLimit(int limit)
This method sets the limit to resulting vocabulary size. PLEASE NOTE: This method is applicable only if huffman tree is built.- Parameters:
limit
-- Returns:
-
allowParallelTokenization
public VocabConstructor.Builder<T> allowParallelTokenization(boolean reallyAllow)
-
useAdaGrad
protected VocabConstructor.Builder<T> useAdaGrad(boolean useAdaGrad)
Defines, if adaptive gradients should be created during vocabulary mastering- Parameters:
useAdaGrad
-- Returns:
-
setTargetVocabCache
public VocabConstructor.Builder<T> setTargetVocabCache(@NonNull @NonNull VocabCache<T> cache)
After temporary internal vocabulary is built, it will be transferred to target VocabCache you pass here- Parameters:
cache
- target VocabCache- Returns:
-
addSource
public VocabConstructor.Builder<T> addSource(@NonNull @NonNull SequenceIterator<T> iterator, int minElementFrequency)
Adds SequenceIterator for vocabulary construction. Please note, you can add as many sources, as you wish.- Parameters:
iterator
- SequenceIterator to build vocabulary fromminElementFrequency
- elements with frequency below this value will be removed from vocabulary- Returns:
-
setStopWords
public VocabConstructor.Builder<T> setStopWords(@NonNull @NonNull Collection<String> stopWords)
-
fetchLabels
public VocabConstructor.Builder<T> fetchLabels(boolean reallyFetch)
Sets, if labels should be fetched, during vocab building- Parameters:
reallyFetch
-- Returns:
-
setIndex
public VocabConstructor.Builder<T> setIndex(InvertedIndex<T> index)
-
enableScavenger
public VocabConstructor.Builder<T> enableScavenger(boolean reallyEnable)
-
setUnk
public VocabConstructor.Builder<T> setUnk(T unk)
-
build
public VocabConstructor<T> build()
-
setLockFactor
public VocabConstructor.Builder<T> setLockFactor(boolean lockf)
-
-