Java Language Detection

 ̄綄美尐妖づ 提交于 2019-12-12 12:01:51

问题


actually, i'm using java Language Detection to detect a text language, and i have this error:

Exception in thread "main" java.lang.IllegalAccessError: tried to access field com.cybozu.labs.langdetect.util.LangProfile.name from class com.cybozu.labs.langdetect.DetectorFactory

here is my code :

    public static String landDetect(String text) throws LangDetectException {
         String profileDirectory ="D:\\Spam Detection PFE 2016\\profiles";
        try {
            DetectorFactory.loadProfile(profileDirectory);
        } catch (LangDetectException ex) {
            Logger.getLogger(attribute_functions.class.getName()).log(Level.SEVERE, null, ex);
        }
    Detector detector = DetectorFactory.create();
        detector.append(text);
    return(detector.detect());

}

来源:https://stackoverflow.com/questions/42602790/java-language-detection

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!