pythonnlplanguage-detection

Detecting whether or not text is English (in bulk)


I'm looking for a simple way to detect whether a short excerpt of text, a few sentences, is English or not. Seems to me that this problem is much easier than trying to detect an arbitrary language. Is there any software out there that can do this? I'm writing in python, and would prefer a python library, but something else would be fine too. I've tried google, but then realized the TOS didn't allow automated queries.


Solution

  • I read a method to detect English language by using Trigrams

    You can go over the text, and try to detect the most used trigrams in the words. If the most used ones match with the most used among english words, the text may be written in English

    Try to look in this ruby project:

    https://github.com/feedbackmine/language_detector