explosion / spacy-stanza

💥 Use the latest Stanza (StanfordNLP) research models directly in spaCy
MIT License
726 stars 60 forks source link

[E048] Can't import language stanza_et from spacy.lang: No module named 'spacy.lang.stanza_et' #51

Closed Lindafr closed 3 years ago

Lindafr commented 4 years ago

Hi, I have been trying to use your module for Estonian stanza (stanza.download("et")), but I can't succeed. When I follow the tutorial in README.md I end up with the error in the headline.

The stanza-spacy-model created by nlp.to_disk("./stanza-spacy-model") creates a folder that has only a vocab/ folder and meta.json. Is this correct? Where can I specify that language "stanza_et" is actually okay?

adrianeboyd commented 4 years ago

Check out this section, in particular the last code block:

https://github.com/explosion/spacy-stanza#advanced-serialization-and-entry-points

The stanza models aren't saved within the spacy model directory, so you have provide them again as a kwarg on load.

lpiagna commented 4 years ago

I have the same issue for the spanish language ("stanza_es"). Regarding @adrianeboyd 's answer, that seems to be a solution only for the english language since setup.py only exposes the "stanza_en" entrypoint. is this the problem? The workaround that I'm trying at the moment is adding the following line to the "entry_points.txt" file in the spacy_stanza-0.2.3.dist-info folder: stanza_es = spacy_stanza:StanzaLanguage

You still need to pass the snlp object to spacy.load when loading the model though, as explained by @adrianeboyd 's answer. is this a viable solution? is there a better way?

adrianeboyd commented 4 years ago

Ah, I missed that, sorry. Thanks for the reply, @lpiagna!

adrianeboyd commented 3 years ago

Hi, the entry points will be fixed in v0.2.5.