Hi I am trying to learn NLTK. I am new to Python as well. I am trying the following.
>>import nltk
>>nltk.pos_tag(nltk.word_tokenize("John lived in China"))
I get the following error message
Traceback (most recent call last): File "", line 1, in nltk.pos_tag(nltk.word_tokenize("John lived in California")) File "C:\Python34\lib\site-packages\nltk\tag__init__.py", line 100, in pos_tag tagger = load(_POS_TAGGER) File "C:\Python34\lib\site-packages\nltk\data.py", line 779, in load resource_val = pickle.load(opened_resource) UnicodeDecodeError: 'ascii' codec can't decode byte 0xcb in position 0: ordinal not in range(128)
I have downloaded all models available (including the maxent_treebank_pos_tagger)
The default system encoding is UTF-8
>>sys.getdefaultencoding()
I opened up the data.py file and this is the content available.
774# Load the resource.
775 opened_resource = _open(resource_url)
776if format == 'raw':
777 resource_val = opened_resource.read()
778 elif format == 'pickle':
779 resource_val = pickle.load(opened_resource)
780 elif format == 'json':
781 import json
What am I doing wrong here?