I am trying to detect language of the string with langdetect package. But it does not work.
from langdetect import detect
word_string = "Books are for reading"
print(detect(word_string))
If I use code above I get error ImportError: cannot import name detect
When I replace detect with *
from langdetect import *
word_string = "Books are for reading"
print(detect(word_string))
I get error: NameError: name 'detect' is not defined
So my question is how can I solve these problems ?
So the problem was that my langdetect package and python file was with the same name.... Thank you for your answers.
Try installing it first by writing :->
!pip install langdetect on terminal
and then import langdetect
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