I have a form which lets users input text snippets. So how can figure out the language of the entered text?
Specifically these languages for now:
Arabic: هذه هي بعض النصوص العربية
Chinese: 这是一些阿拉伯文字
Japanese: これは、いくつかのアラビア語のテキストです
[Edit] The detection has work on text which is retrieved via an API too (no browser involved)
Googletrans python library uses the google translate API to detect the language of text data.
#1 – LingueeLinguee can detect and translate 25 languages and 234 language pairs in total by analyzing billions of translations. It's backed by the power of almost 400 lexicographers, translators, and linguists.
On the Review tab, in the Language group, click Language. Click Set Proofing Language. In the Language dialog box, select the Detect language automatically check box.
Google Translate's camera can now automatically detect languages.
You can figure out whether the characters are from the Arabic, Chinese, or Japanese sections of the Unicode map.
If you look at the list on Wikipedia, you'll see that each of those languages has many sections of the map. But you're not doing translation, so you don't need to worry about every last glyph.
For example, your Chinese text begins (in hex) 0x8FD9 0x662F 0x4E00 - and those are all in the "CJK Unified Ideographs" section, which is Chinese. Here are a few ranges to get you started:
Arabic (0600–06FF)
Japanese
Chinese
(I got the hex for your Chinese by using a Chinese to Unicode Converter.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With