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
BllipParser: AttributeError: 'str' object has no attribute 'decode' on Python 3.5 #1920
Comments
Hey! May I solve this? |
So nobody ever solved this? Currently I have to wrap words in a dummy class with a decode method that does nothing. I'd love to remove that from my code. |
Here is the traceback, happens when I use Bllip's ~/venv/3.7/lib/python3.7/site-packages/nltk-3.4.4-py3.7.egg/nltk/parse/api.py in parse_one(self, sent, *args, **kwargs)
70 def parse_one(self, sent, *args, **kwargs):
71 """:rtype: Tree or None"""
---> 72 return next(self.parse(sent, *args, **kwargs), None)
~/venv/3.7/lib/python3.7/site-packages/nltk-3.4.4-py3.7.egg/nltk/parse/bllip.py in parse(self, sentence)
182 :rtype: iter(Tree)
183 """
--> 184 _ensure_ascii(sentence)
185 nbest_list = self.rrp.parse(sentence)
186 for scored_parse in nbest_list:
~/venv/3.7/lib/python3.7/site-packages/nltk-3.4.4-py3.7.egg/nltk/parse/bllip.py in _ensure_ascii(words)
103 try:
104 for i, word in enumerate(words):
--> 105 word.decode('ascii')
106 except UnicodeDecodeError:
107 raise ValueError(
AttributeError: 'str' object has no attribute 'decode' |
When calling next(BllipParser.parse()) on Python 3.5, I receive the following error:
File "/home/andrew/.local/lib/python3.5/site-packages/nltk/parse/bllip.py", line 169, in parse
_ensure_ascii(sentence)
File "/home/andrew/.local/lib/python3.5/site-packages/nltk/parse/bllip.py", line 101, in _ensure_ascii
word.decode('ascii')
AttributeError: 'str' object has no attribute 'decode'
Related to #507
NLTK v3.2.5
Python v3.5.2
OS: Ubuntu (16.04.3) running on WSL (16299.125)
The text was updated successfully, but these errors were encountered: