How to solve the spacy latin language import error

Viewed 84

i installed spacy_stanza and downloaded the latin model, but i get this error:

ImportError: [E048] Can't import language la or any matching language from spacy.lang: No module named 'spacy.lang.la'

here's the code i use:

import spacy
import stanza
import spacy_stanza

stanza.download("la")

nlp = spacy_stanza.load_pipeline("la")
doc = nlp(textstr)
for token in doc:
   print(token.text, token.lemma_, token.pos_)

why does it not work? Can somebody help me?

1 Answers

spaCy doesn't have built-in support for Latin, so you need to load the pipeline a bit differently. See the spacy-stanza docs. Modifying the Coptic example there slightly:

nlp = spacy_stanza.load_pipeline("xx", lang="la")

Should work.

Related