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.
import langdetectand thenlangdetect.detect()?detectfunction doesn't exist with that name...