public abstract class LanguageDetector
extends java.lang.Object
Constructor and Description |
---|
LanguageDetector() |
Modifier and Type | Method and Description |
---|---|
abstract void |
addText(char[] cbuf,
int off,
int len)
Add statistics about this text for the current document.
|
void |
addText(java.lang.CharSequence text)
Add
|
LanguageResult |
detect() |
LanguageResult |
detect(java.lang.CharSequence text) |
abstract java.util.List<LanguageResult> |
detectAll()
Detect languages based on previously submitted text (via addText calls).
|
java.util.List<LanguageResult> |
detectAll(java.lang.String text)
Utility wrapper that detects the language of a given chunk of text.
|
static LanguageDetector |
getDefaultLanguageDetector() |
static java.util.List<LanguageDetector> |
getLanguageDetectors() |
static java.util.List<LanguageDetector> |
getLanguageDetectors(ServiceLoader loader) |
boolean |
hasEnoughText()
Tell the caller whether more text is required for the current document
before the language can be reliably detected.
|
abstract boolean |
hasModel(java.lang.String language)
Provide information about whether a model exists for a specific
language.
|
boolean |
isMixedLanguages() |
boolean |
isShortText() |
abstract LanguageDetector |
loadModels()
Load (or re-load) all available language models.
|
abstract LanguageDetector |
loadModels(java.util.Set<java.lang.String> languages)
Load (or re-load) the models specified in
|
abstract void |
reset()
Reset statistics about the current document being processed
|
LanguageDetector |
setMixedLanguages(boolean mixedLanguages) |
abstract LanguageDetector |
setPriors(java.util.Map<java.lang.String,java.lang.Float> languageProbabilities)
Set the a-priori probabilities for these languages.
|
LanguageDetector |
setShortText(boolean shortText) |
public static LanguageDetector getDefaultLanguageDetector()
public static java.util.List<LanguageDetector> getLanguageDetectors()
public static java.util.List<LanguageDetector> getLanguageDetectors(ServiceLoader loader)
public boolean isMixedLanguages()
public LanguageDetector setMixedLanguages(boolean mixedLanguages)
public boolean isShortText()
public LanguageDetector setShortText(boolean shortText)
public abstract LanguageDetector loadModels() throws java.io.IOException
java.io.IOException
public abstract LanguageDetector loadModels(java.util.Set<java.lang.String> languages) throws java.io.IOException
languages
- list of target languages.java.io.IOException
public abstract boolean hasModel(java.lang.String language)
language
- ISO 639-1 name for languagepublic abstract LanguageDetector setPriors(java.util.Map<java.lang.String,java.lang.Float> languageProbabilities) throws java.io.IOException
languageProbabilities
- Map from language to probabilityjava.io.IOException
public abstract void reset()
public abstract void addText(char[] cbuf, int off, int len)
cbuf
- Character bufferoff
- Offset into cbuf to first character in the run of textlen
- Number of characters in the run of text.public void addText(java.lang.CharSequence text)
text
- Characters to add to current statistics.public boolean hasEnoughText()
public abstract java.util.List<LanguageResult> detectAll()
public LanguageResult detect()
public java.util.List<LanguageResult> detectAll(java.lang.String text)
text
- String to add to current statistics.public LanguageResult detect(java.lang.CharSequence text)
"Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"