public class TextLangDetector extends LanguageDetector
mixedLanguages, shortText| Constructor and Description |
|---|
TextLangDetector() |
| Modifier and Type | Method and Description |
|---|---|
void |
addText(char[] cbuf,
int off,
int len)
Add statistics about this text for the current document.
|
protected static boolean |
canRun() |
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.
|
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, setShortTextpublic LanguageDetector loadModels() throws IOException
LanguageDetectorloadModels in class LanguageDetectorIOExceptionpublic LanguageDetector loadModels(Set<String> set) throws IOException
LanguageDetectorloadModels in class LanguageDetectorset - list of target languages.IOExceptionpublic boolean hasModel(String language)
LanguageDetectorhasModel in class LanguageDetectorlanguage - ISO 639-1 name for languagepublic LanguageDetector setPriors(Map<String,Float> languageProbabilities) throws IOException
LanguageDetectorsetPriors in class LanguageDetectorlanguageProbabilities - Map from language to probabilityIOExceptionpublic void reset()
LanguageDetectorreset in class LanguageDetectorpublic void addText(char[] cbuf,
int off,
int len)
LanguageDetectoraddText in class LanguageDetectorcbuf - 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()
LanguageDetectordetectAll in class LanguageDetectorprotected static boolean canRun()
Copyright © 2007–2021 The Apache Software Foundation. All rights reserved.