How to create a language Detector in python
You can detect language in a text using a Python library called langdetect. At the moment, this detector supports about 55 languages. Here are the supported languages below:
af, ar, bg, bn, ca, cs, cy, da, de, el, en, es,
et, fa, fi, fr, gu, he,
hi, hr, hu, id, it, ja, kn, ko, lt, lv, mk, ml,
mr, ne, nl, no, pa, pl,
pt, ro, ru, sk, sl, so, sq, sv, sw, ta, te, th,
tl, tr, uk, ur, vi, zh-cn, zh-tw
To use the library, install using pip;
pip install langdetect
It takes a string of words and detects the language. Below, it
can be detected that the language is Japanese.
from langdetect import detect # Language to detect
lang = detect("愛してる")
print(lang)
Output:
ja