public class LanguageProfileBuilder extends Object
LanguageProfile
.
This class does no internal synchronization.
Constructor and Description |
---|
LanguageProfileBuilder(@NotNull LdLocale locale) |
LanguageProfileBuilder(@NotNull 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(@NotNull NgramExtractor ngramExtractor) |
public LanguageProfileBuilder(@NotNull @NotNull LdLocale locale)
@Deprecated public LanguageProfileBuilder(@NotNull @NotNull String locale)
public LanguageProfileBuilder ngramExtractor(@NotNull @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 © 2024. All rights reserved.