Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java语言检测_Java_Language Translation - Fatal编程技术网

Java语言检测

Java语言检测,java,language-translation,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 l

实际上,我正在使用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());

}

也许您应该尝试访问库,而不是寻求stackoverflow的支持,因为您的代码似乎与相同。LangProfile中的
name
字段是私有的吗?它似乎试图访问该字段,但它无法访问;而不是一个。谢谢你