pemistahl / lingua

The most accurate natural language detection library for Java and the JVM, suitable for long and short text alike
Apache License 2.0
712 stars 65 forks source link

LanguageDetector#detectLanguageOf #212

Closed hasandiwan closed 2 months ago

hasandiwan commented 4 months ago

According to the documentation -- https://javadoc.io/doc/com.github.pemistahl/lingua/0.3.0/com/github/pemistahl/lingua/api/LanguageDetector.html -- and the project's README -- https://github.com/pemistahl/lingua/blob/main/README.md -- the code below should return a Language object:

final LanguageDetector detector = LanguageDetectorBuilder.fromLanguages(ENGLISH, FRENCH, GERMAN, SPANISH).build();
final Language detectedLanguage = detector.detectLanguageOf("languages are awesome");

... but it throws a java.util.concurrent.ExecutionException.

pemistahl commented 2 months ago

@hasandiwan Sorry for my late response. The code you have posted should work just fine. I have no idea why you are getting an exception there. It is most probably related to your own code and environment which you use the language detector in.