Class LanguageProfileBuilder
java.lang.Object
com.optimaize.langdetect.profiles.LanguageProfileBuilder
Builder for
LanguageProfile
.
This class does no internal synchronization.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final @NotNull LdLocale
private int
private NgramExtractor
-
Constructor Summary
ConstructorsConstructorDescriptionLanguageProfileBuilder
(@NotNull LdLocale locale) LanguageProfileBuilder
(@NotNull String locale) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionShortcut for addGram(ngram, 1).If the builder already has this ngram, the given frequency is added to the current count.addText
(CharSequence text) In order to use this you must set thengramExtractor
first.build()
minimalFrequency
(int minimalFrequency) ngramExtractor
(@NotNull NgramExtractor ngramExtractor) private void
-
Field Details
-
locale
-
minimalFrequency
private int minimalFrequency -
ngramExtractor
-
ngrams
-
-
Constructor Details
-
LanguageProfileBuilder
-
LanguageProfileBuilder
Deprecated.
-
-
Method Details
-
ngramExtractor
-
minimalFrequency
- Parameters:
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.
-
addText
In order to use this you must set thengramExtractor
first. -
addGram
Shortcut for addGram(ngram, 1). -
addGram
If the builder already has this ngram, the given frequency is added to the current count. -
build
-
removeNgramsWithLessFrequency
private void removeNgramsWithLessFrequency()
-