Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to ensure user submit only english text

I am building a project involving natural language processing, since the nlp module currently only deal with english text, so I have to make sure the user submitted content (not long, only several words) is in english. Are there established ways to achieve this? Python or Javascript way preferred.

like image 445
btw0 Avatar asked Oct 13 '08 07:10

btw0


2 Answers

If the content is long enough I would suggest some frequency analysis on the letters.

But for a few words I think your best bet is to compare them to an English dictionary and accept the input if half of them match.

like image 82
Pat Avatar answered Sep 25 '22 21:09

Pat


Check the Language Recognition Chart

like image 44
AquilaX Avatar answered Sep 23 '22 21:09

AquilaX