public abstract class AbstractLanguageRecognizer extends IsCloseableObject implements LanguageRecognizer, UsesLogger
Modifier and Type | Field and Description |
---|---|
protected Logger |
logger
Logger used for output.
|
Constructor and Description |
---|
AbstractLanguageRecognizer()
Create a language recognizer with the default language profiles.
|
AbstractLanguageRecognizer(java.util.List<java.lang.String> languages)
Create a language recognizer with list of languages to recognize.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the language recognizer.
|
Logger |
getLogger()
Get the logger.
|
abstract ScoredString[] |
recognizeLanguage(java.lang.String text)
Returns a scored list of possible languages for a text string.
|
void |
setLogger(Logger logger)
Set the logger.
|
protected Logger logger
public AbstractLanguageRecognizer() throws LangDetectException
LangDetectException
public AbstractLanguageRecognizer(java.util.List<java.lang.String> languages) throws LangDetectException
languages
- List of names of languages to recognize.
The list of languages references the profile names. These are usually two or three character ISO 696 language codes, e.g., "en" for English and "sco" for Scots dialect.
LangDetectException
public abstract ScoredString[] recognizeLanguage(java.lang.String text)
recognizeLanguage
in interface LanguageRecognizer
text
- The text for which to determine the language.public Logger getLogger()
getLogger
in interface UsesLogger
public void setLogger(Logger logger)
setLogger
in interface UsesLogger
logger
- The logger.public void close()
close
in class IsCloseableObject