Java language definition

Actually, I am 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());

}
+4
source share

Source: https://habr.com/ru/post/1671483/


All Articles