No longer compatible with spacy v3.0?
Closed this issue · 1 comments
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').
-
If you created your component with
nlp.create_pipe('name')
: remove nlp.create_pipe and callnlp.add_pipe('name')
instead. -
If you passed in a component like
TextCategorizer()
: callnlp.add_pipe
with the string name instead, e.g.nlp.add_pipe('textcat')
. -
If you're using a custom component: Add the decorator
@Language.component
(for function components) or@Language.factory
(for class components / factories) to your custom component and assign it a name, e.g.@Language.component('your_name')
. You can then runnlp.add_pipe('your_name')
to add it to the pipeline.
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)) ```
@srBrehm I finally upgraded to spaCy 3. Your issues should be fixed