public class Lingo24LangDetector extends LanguageDetector
langdetect.lingo24.properties
file.mixedLanguages, shortText
Constructor and Description |
---|
Lingo24LangDetector()
Default constructor which first checks for the presence of
the
langdetect.lingo24.properties file to set the API Key. |
Modifier and Type | Method and Description |
---|---|
void |
addText(char[] cbuf,
int off,
int len)
Add statistics about this text for the current document.
|
List<LanguageResult> |
detectAll()
Detect languages based on previously submitted text (via addText calls).
|
boolean |
hasModel(String language)
Provide information about whether a model exists for a specific
language.
|
boolean |
isAvailable() |
LanguageDetector |
loadModels()
Load (or re-load) all available language models.
|
LanguageDetector |
loadModels(Set<String> set)
Load (or re-load) the models specified in
|
void |
reset()
Reset statistics about the current document being processed
|
LanguageDetector |
setPriors(Map<String,Float> languageProbabilities)
Set the a-priori probabilities for these languages.
|
addText, detect, detect, detectAll, getDefaultLanguageDetector, getLanguageDetectors, getLanguageDetectors, hasEnoughText, isMixedLanguages, isShortText, setMixedLanguages, setShortText
public Lingo24LangDetector()
langdetect.lingo24.properties
file to set the API Key.
If a key is available, it sets the detector as available and also loads the languages supported by the detector.
public LanguageDetector loadModels() throws IOException
LanguageDetector
loadModels
in class LanguageDetector
IOException
public LanguageDetector loadModels(Set<String> set) throws IOException
LanguageDetector
loadModels
in class LanguageDetector
set
- list of target languages.IOException
public boolean hasModel(String language)
LanguageDetector
hasModel
in class LanguageDetector
language
- ISO 639-1 name for languagepublic LanguageDetector setPriors(Map<String,Float> languageProbabilities) throws IOException
LanguageDetector
If hasModel() returns false for any of the languages, an IllegalArgumentException is thrown.
Use of these probabilities is detector-specific, and thus might not impact the results at all. As such, these should be viewed as a hint.
setPriors
in class LanguageDetector
languageProbabilities
- Map from language to probabilityIOException
public void reset()
LanguageDetector
reset
in class LanguageDetector
public void addText(char[] cbuf, int off, int len)
LanguageDetector
addText
in class LanguageDetector
cbuf
- Character bufferoff
- Offset into cbuf to first character in the run of textlen
- Number of characters in the run of text.public List<LanguageResult> detectAll()
LanguageDetector
detectAll
in class LanguageDetector
public boolean isAvailable()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.