language-detection 检测语言编码 java

最近做项目需要各种语言编码 找了很久终于找到解决方案

其project链接如下:http://code.google.com/p/language-detection。基本上,你只需要引用langdetect.jar和其依赖的jsonic-1.3.0.jar

public static void main(String[] args) {

      

        try {

//加载语言资源包

            DetectorFactory.loadProfile("profiles");
        } catch (LangDetectException e) {
            e.printStackTrace();
        }

        Detector detect;
        try {
            detect = DetectorFactory.create();
            detect.append("Twój kod potwierdzający to 498071 ");
            System.out.println(detect.detect());
        } catch (LangDetectException e) {
            e.printStackTrace();

        }

try {
            detect = DetectorFactory.create();
            detect.append("打扫打扫撒 ");
            System.out.println(detect.detect());
        } catch (LangDetectException e) {
            e.printStackTrace();
        }


    }

你可能感兴趣的:(language-detection 检测语言编码 java)