Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot import name "StanfordTokenizer" #25

Closed
bayou3 opened this issue Mar 25, 2018 · 1 comment
Closed

Cannot import name "StanfordTokenizer" #25

bayou3 opened this issue Mar 25, 2018 · 1 comment

Comments

@bayou3
Copy link

bayou3 commented Mar 25, 2018

Hello,
There is a line in wikiTokenize.py: "from nltk.tokenize import StanfordTokenizer"
But when I try to run the command as : python wikiTokenize.py filename.txt , it pops up a prompt that Cannot import name "StanfordTokenizer".
I install nltk by this command: pip install nltk. In the nltk installation path, /anaconda3/envs/py3/lib/python3.6/site-packages/nltk/tokenize, there is stanford_segmenter.py and stanford.py, but no StanfordTokenizer.py.
So can I ask how to fix this problem?

@bayou3
Copy link
Author

bayou3 commented Mar 25, 2018

Ah, sorry for asking for help. I have already found the way to fix the issue:
it just need to change "from nltk.tokenize import StanfordTokenizer"
to
"from nltk.tokenize.stanford import StanfordTokenizer"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants