问题
I have installed the latest version of nlpnet library (http://nilc.icmc.usp.br/nlpnet/). Then, when I try to use nlpnet POSTagger according to the follwoing example, I get an error:
import nlpnet
tagger = nlpnet.POSTagger('/path/to/pos-model/', language='pt')
Error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 205, in __init__
self._load_data()
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 423, in _load_data
self.nn = load_network(md)
File "/home/r/env2/lib/python3.6/site-packages/nlpnet/taggers.py", line 38, in load_network
nn = net_class.load_from_file(md.paths[md.network])
File "nlpnet/network.pyx", line 860, in nlpnet.network.Network.load_from_file (nlpnet/network.c:14631)
File "/home/r/env2/lib/python3.6/site-packages/numpy/lib/npyio.py", line 262, in __getitem__
pickle_kwargs=self.pickle_kwargs)
File "/home/r/env2/lib/python3.6/site-packages/numpy/lib/format.py", line 722, in read_array
raise ValueError("Object arrays cannot be loaded when "
ValueError: Object arrays cannot be loaded when allow_pickle=False
I also tried to install nlpnet again in a different virtual environment, but the error persists. I'm not sure if this is a incompatibility problem, a bug in the lib or an installation issue.
Any suggestions?
回答1:
I am also using nlpnet, and I had the same problem. Searching on Google, I found this question on Stack Overflow. Following one of the answers, I downgraded numpy to version 1.16.1, and it worked for me.
pip install numpy==1.16.1
Hope it helps you.
来源:https://stackoverflow.com/questions/57361531/nlpnet-postagger-returns-error-message-when-allow-pickle-false