/ntc-langdetect

ntc-langdetect is a module Language Detector using Apache OpenNLP

Primary LanguageJavaApache License 2.0Apache-2.0

ntc-langdetect

ntc-langdetect is a library Language Detector using Apache OpenNLP

Maven

<dependency>
    <groupId>com.streetcodevn</groupId>
    <artifactId>ntc-langdetect</artifactId>
    <version>1.0.0</version>
</dependency>

Build local

# Build
mvn package
or
mvn -Dmaven.test.skip=true package

# Clean
mvn clean install

Quick start

LangDetect ld = new LangDetect();
String s = "anh yêu em";
// Get the most probable language
Language bestLanguage = ld.langDetect(s);
System.out.println("bestLanguage: " + bestLanguage.toString());

// or

Language bestLanguage = ld.getLdME().predictLanguage(s);
System.out.println("bestLanguage: " + bestLanguage.toString());

License

This code is under the Apache License v2.