Java语言检测

时间:2017-03-04 23:54:50

标签: java language-translation

实际上,我正在使用java语言检测来检测文本语言,我有这个错误:

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

这是我的代码:

    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());

}

0 个答案:

没有答案