LanguageDetectorExample { public String detectLanguage(String text) throws IOException { LanguageDetector detector = new OptimaizeLangDetector().loadModels(); LanguageResult result = detector.detect(text); return result.getLanguage(); }  String detectLanguage(String text);  }
@Test public void testDetectLanguage() throws IOException { String text = "This is some text that should be identified as English."; assertEquals("en", languageDetectorExample.detectLanguage(text)); }