Error on Mac OSX running nlpnet.POSTagger() - AttributeError: 'POSReader' object has no attribute 'word_dict'
Closed this issue · 3 comments
Hi,
When running the same script, working on Linux, on my Mac I've got the following error:
command:
nlpnet.set_data_dir('/Users/renatofreitasmartins/Documents/nlpnet-data/')
tagger = nlpnet.POSTagger()
error:
Traceback (most recent call last):
File "", line 1, in
File "/Library/Python/2.7/site-packages/nlpnet/taggers.py", line 140, in init
self._load_data()
File "/Library/Python/2.7/site-packages/nlpnet/taggers.py", line 254, in _load_data
self.reader.create_converter()
File "/Library/Python/2.7/site-packages/nlpnet/reader.py", line 220, in create_converter
self.converter.add_extractor(self.word_dict.get)
AttributeError: 'POSReader' object has no attribute 'word_dict'
I got another error before regarding the set_data_dir parameter, but it's solved. I have tried even to remove everything and install again, but I think I am missing something.. any idea?
Hi,
are you sure you have the same version on both installations? Anyway, I checked the line numbers in your stack trace and this is not the latest one. Please update and check if the error persists.
But I must warn you that the latest version uses a slightly different data format. Compatible trained models for Portuguese can be found at http://143.107.183.175:21580/nlpnet/models.html.
Hi Erick, thanks for the reply.
I downloaded the latest version and installed it again, along with the training models for Portuguese. Now the error changed, see below.
To upgrade, it's only to install again or I have to remove any folder?
Thank you!
Traceback (most recent call last):
File "gera_Tag.py", line 67, in
main()
File "gera_Tag.py", line 49, in main
tagger = nlpnet.POSTagger()
File "/Library/Python/2.7/site-packages/nlpnet/taggers.py", line 139, in init
self._load_data()
File "/Library/Python/2.7/site-packages/nlpnet/taggers.py", line 251, in _load_data
self.nn = load_network(md)
File "/Library/Python/2.7/site-packages/nlpnet/taggers.py", line 31, in load_network
nn = net_class.load_from_file(md.paths[md.network])
File "nlpnet\network.pyx", line 854, in nlpnet.network.Network.load_from_file (nlpnet/network.c:12920)
TypeError: Expected str, got unicode
Erick,
now it worked. The problem is with the file encoding. I will open another issue to talk about it.
Thank you very much!