public class LanguageProfileBuilder extends Object
LanguageProfile.
This class does no internal synchronization.
| Constructor and Description |
|---|
LanguageProfileBuilder(LdLocale locale) |
LanguageProfileBuilder(String locale)
Deprecated.
|
| Modifier and Type | Method and Description |
|---|---|
LanguageProfileBuilder |
addGram(String ngram)
Shortcut for addGram(ngram, 1).
|
LanguageProfileBuilder |
addGram(String ngram,
int frequency)
If the builder already has this ngram, the given frequency is added to the current count.
|
LanguageProfileBuilder |
addText(CharSequence text)
In order to use this you must set the
ngramExtractor first. |
LanguageProfile |
build() |
LanguageProfileBuilder |
minimalFrequency(int minimalFrequency) |
LanguageProfileBuilder |
ngramExtractor(NgramExtractor ngramExtractor) |
public LanguageProfileBuilder(@NotNull
LdLocale locale)
@Deprecated public LanguageProfileBuilder(@NotNull String locale)
public LanguageProfileBuilder ngramExtractor(@NotNull NgramExtractor ngramExtractor)
public LanguageProfileBuilder minimalFrequency(int minimalFrequency)
minimalFrequency - 1-n, the default is 1. n-grams that occurred less often in the text are removed.
This really should be set to something higher.
Try to play with the number until you get a profile file of satisfying size,
that produces good language detection results.public LanguageProfileBuilder addText(CharSequence text)
ngramExtractor first.public LanguageProfileBuilder addGram(String ngram)
public LanguageProfileBuilder addGram(String ngram, int frequency)
public LanguageProfile build()
Copyright © 2015. All rights reserved.