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

com.github.pemistahl.lingua.api.LanguageDetector#detectLanuguageOf NoSuchMethodError with String #210

Closed hasandiwan closed 7 months ago

hasandiwan commented 7 months ago

LanguageDetector detector = LanguageDetectorBuilder.fromAllLanguages().build().detectLanguageOf("I am what I am and no one says...");

Yields a NoSuchMethodError. Help?

pemistahl commented 7 months ago

Please read the docs carefully. Your code does not make sense. The following is the correct one:

LanguageDetector detector = LanguageDetectorBuilder.fromAllLanguages().build();
Language language = detector.detectLanguageOf("I am what I am and no one says...");
hasandiwan commented 7 months ago

String text = "hello world"; LanguageDetector detector = LanguageDetectorBuilder.fromAllLanguages().build(); Language language = detector.detectLanguage(text);

Now how do I get "English" from the language object?