问题
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