@Reference(type=Article, author={"Lui, Marco","Baldwin, Timothy"}, title="Cross-domain Feature Selection for Language Identification", year="2011", booktitle="in Proceedings of 5th International Joint Conference on Natural Language Processing") public class LanguageDetector extends Object
Modifier and Type | Class and Description |
---|---|
static class |
LanguageDetector.WeightedLocale
A langauge with an associated confidence
|
Modifier and Type | Field and Description |
---|---|
static String |
LANGUAGE_MODEL_BINARY
default location of the compressed binary version of the language model
|
static String |
LANGUAGE_MODEL_JSON
default location of the compressed json version language model
|
Constructor and Description |
---|
LanguageDetector()
Load a language model from "/org/openimaj/text/language/language.model.binary.gz"
|
LanguageDetector(LanguageModel model)
Create a language detector with a provided language model
|
Modifier and Type | Method and Description |
---|---|
LanguageDetector.WeightedLocale |
classify(String text)
Classify the language using a naive-bayes model
|
LanguageModel |
getLanguageModel() |
static void |
main(String[] args)
prints available languages
|
public static final String LANGUAGE_MODEL_JSON
public static final String LANGUAGE_MODEL_BINARY
public LanguageDetector() throws IOException
IOException
public LanguageDetector(LanguageModel model)
model
- public LanguageDetector.WeightedLocale classify(String text)
text
- public LanguageModel getLanguageModel()
LanguageModel
public static void main(String[] args) throws IOException
args
- IOException