Python - can I detect unicode string language code?

前端 未结 7 2053
遇见更好的自我
遇见更好的自我 2020-11-27 16:29

I\'m faced with a situation where I\'m reading a string of text and I need to detect the language code (en, de, fr, es, etc).

Is there a simple way to do this in py

7条回答
  •  渐次进展
    2020-11-27 16:49

    A useful article here suggests that this open source named CLD is the best bet for detecting language in python.

    The article shows a comparison of speed and accuracy between 3 solutions :

    1. language-detection or its python port langdetect
    2. Tika
    3. Chromium Language Detection (CLD)

    I wasted my time with langdetect now I am switching to CLD which is 16x faster than langdetect and has 98.8% accuracy

提交回复
热议问题