什么是最好的语言检测库或web api?[甚至支付]

ced*_*vad 6 language-detection

首先,我有很多文字可供使用.比方说,我每次尝试都有10000个字符.该脚本是基于PHP的,但我可以使用我想要的任何东西.C++,java,没问题.

不能使用谷歌语言API:他们的使用限制很低.

6个小时,我试着想出任何好的东西,但现在没有.有人能指出我最好的机会吗?

lis*_*sak 9

基于Java的工具是:

Apache Tika:不是"所有"语言配置文件,但您可以自己添加它们

public String detectLangTika(String text) throws SystemException {
    LanguageIdentifier li = new LanguageIdentifier(text);
    if (li.isReasonablyCertain())
        return li.getLanguage();
    else
        throw new Exception("Tika lang detection not reasonably certain");
}
Run Code Online (Sandbox Code Playgroud)

语言检测:很多语言配置文件对我很有用.

    DetectorFactory.loadProfile(new File(LangDetector.class.getClassLoader().getResource("profiles").toURI()));

public String detectLangLD(String text) throws SystemException {

    Detector detector;
    String lang;
    try {
        detector = DetectorFactory.create();
        detector.append(text);
        lang = detector.detect();
    } catch (LangDetectException e) {
        throw new SystemException("LangDetector Failure", e);
    }
    return lang;
}
Run Code Online (Sandbox Code Playgroud)

最精确的工具是Google API lang检测,已停止使用已付费的Google Translate API.


Lau*_*nas 9

语言检测API,提供免费和优质的服务.

它通过GET或POST接受文本,并提供带有分数的JSON输出.

  • 它安全可靠吗?隐私呢? (2认同)