dpalmasan / TRUNAJOD2.0

An easy-to-use library to extract indices from texts.
https://trunajod20.readthedocs.io/en/latest/
MIT License
29 stars 7 forks source link

Error while running example #46

Closed mbdemoraes closed 3 years ago

mbdemoraes commented 3 years ago

I've successfully installed TRUNAJOD and its dependencies. However, when I tried to run the example presented in the README, the following error occurred:

Traceback (most recent call last):
  File "main.py", line 44, in <module>
    nlp = spacy.load("es", disable=["ner", "textcat"])
  File "/home/matheus/.local/lib/python3.8/site-packages/spacy/__init__.py", line 47, in load
    return util.load_model(name, disable=disable, exclude=exclude, config=config)
  File "/home/matheus/.local/lib/python3.8/site-packages/spacy/util.py", line 328, in load_model
    raise IOError(Errors.E941.format(name=name, full=OLD_MODEL_SHORTCUTS[name]))
OSError: [E941] Can't find model 'es'. It looks like you're trying to load a model from a shortcut, which is deprecated as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("es_core_news_sm")

For more details on the available models, see the models directory: https://spacy.io/models. If you want to create a blank model, use spacy.blank: nlp = spacy.blank("es")
dpalmasan commented 3 years ago

Hello @mbdemoraes ; Probably I should state directly that some spacy model should be installed in the README? For example:

python -m spacy download es_core_news_sm

Maybe I can add that to the README.md plus a link to the spacy docs for model installation?

supersonic1999 commented 3 years ago

I changed:

nlp = spacy.load("es", disable=["ner", "textcat"])

to

nlp = spacy.load("es_core_news_sm", disable=["ner", "textcat"])

and it worked fine after.

According to the runtime error:

"Can't find model 'es'. It looks like you're trying to load a model from a shortcut, which is deprecated as of spaCy v3.0. To load the model, use its full name instead:

nlp = spacy.load("es_core_news_sm")"

dpalmasan commented 3 years ago

Thanks for the clarification @supersonic1999 ! I have updated the README.md to explicitly state that a model needs to be installed to run the example (in particular a model for the Spanish language in the example)

mbdemoraes commented 3 years ago

@dpalmasan and @supersonic1999 thanks for the reply! Modifying the example on the README and the inclusion of the explicit instruction on how to download a spacy model worked just fine for me. Just don't forget to change the example on the documentation too :)

mbdemoraes commented 3 years ago

I've checked the documentation and it is ok now. I'm closing the issue. Thank you guys!