How can I detect a user's input language using Ruby without using an online service?

后端 未结 4 720
星月不相逢
星月不相逢 2021-01-15 06:11

I\'m looking for a library or technique to detect the input language of blocks of text provided by users. Online lookups (like Google translate) won\'t work for this task as

4条回答
  •  隐瞒了意图╮
    2021-01-15 06:19

    Here are two more n-gram-based gems you might want to try. They work offline.

    • https://github.com/echen/unsupervised-language-identification, optimized for separating english and other languages (has a live demo)
    • https://github.com/feedbackmine/language_detector, less specialized, will detect more languages. Some languages may need some extra training — I found it to be not precise enough for German text.

提交回复
热议问题