FastText library by facebook has the language detection feature.
import fasttext
model = fasttext.load_model("/tmp/lid.176.ftz")
model.predict(" विकिपीडिया पर", k=2)
The above code returns Hindi "hi" correctly. Google also has it's own library called langdetect. The following code returns Marathi "mr" correctly.
from langdetect import detect
detect("आत्मा आणि")
The polyglot library has supported this and other language tools since a very long time.
https://github.com/saffsd/polyglot
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.