Liebeck / spacy-iwnlp

German lemmatization with IWNLP as extension for spaCy
MIT License
23 stars 2 forks source link

No longer compatible with spacy v3.0? #5

Closed sonja-brehm closed 1 year ago

sonja-brehm commented 1 year ago

I get error messages when I try to run the code as explained. I tried some things out, but I couldn't make it work.

Error Message: [E966] nlp.add_pipe now takes the string name of the registered component factory, not a callable component. Expected string, but got <spacy_iwnlp.spaCyIWNLP object at 0x7f921cddcdf0> (name: 'None').

My code:


from spacy_iwnlp import spaCyIWNLP
nlp = spacy.load('de_core_news_sm')
iwnlp = spaCyIWNLP(lemmatizer_path='data/IWNLP.Lemmatizer_20181001.json')
nlp.add_pipe(iwnlp)
doc = nlp('Wir mögen Fußballspiele mit ausgedehnten Verlängerungen.')
for token in doc:
    print('POS: {}\tIWNLP:{}'.format(token.pos_, token._.iwnlp_lemmas)) ```
Liebeck commented 1 year ago

@srBrehm I finally upgraded to spaCy 3. Your issues should be fixed