Detects language of the given text. Returns detected language codes and scores.
Add this dependency to your pom.xml
:
<dependency>
<groupId>com.detectlanguage</groupId>
<artifactId>detectlanguage</artifactId>
<version>1.1.0</version>
</dependency>
Add this dependency to your build.gradle
:
repositories {
mavenCentral()
}
dependencies {
compile 'com.detectlanguage:detectlanguage:1.1.0'
}
import com.detectlanguage.DetectLanguage;
Before using Detect Language API client you have to setup your personal API key. You can get it by signing up at https://detectlanguage.com
DetectLanguage.apiKey = "YOURAPIKEY";
// Enable secure mode (SSL) if passing sensitive information
// DetectLanguage.ssl = true;
List<Result> results = DetectLanguage.detect("Hello world");
Result result = results.get(0);
System.out.println("Language: " + result.language);
System.out.println("Is reliable: " + result.isReliable);
System.out.println("Confidence: " + result.confidence);
String language = DetectLanguage.simpleDetect("Hello world");
String[] texts = {
"Hello world",
"Labas rytas"
};
List<List<Result>> results = DetectLanguage.detect(texts);
Which you can download to target/dependency
using:
mvn dependency:copy-dependencies
Please use appropriately tagged github issues to request features or report bugs.
mvn test
mvn clean deploy
mvn release:clean
mvn release:prepare
mvn release:perform
Done using the Sonatype Nexus UI.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Write your code and tests
- Ensure all tests still pass
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new pull request