-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Labels
enhancementFeature requests and improvementsFeature requests and improvements
Description
I tried to implement a simple lemmatization for German via a custom addition to the nlp pipeline:
from textblob_de import WordList
import spacy
nlp = spacy.load("de")
def textblob_lemmas(doc):
for sent in doc.sents:
lemmas = WordList([str(w) for w in sent]).lemmatize()
for w, l in zip(sent, lemmas):
w.lemma_ = l
nlp.pipeline = [nlp.tagger, nlp.parser, nlp.entity, textblob_lemmas]
nlp("Dies ist ein Test.")However unfortunately, this raises AttributeError: attribute 'lemma_' of 'spacy.tokens.token.Token' objects is not writable.
[Same happens if I use
def custom_pipeline(nlp):
return (nlp.tagger, nlp.parser, textblob_lemmas, nlp.entity)
nlp = spacy.load('de', create_pipeline=custom_pipeline)
for defining nlp instead]
Your Environment
- Operating System: Windows 10, 64bit
- Python Version Used: 3.6
- spaCy Version Used: 1.7.5
- Environment Information:
Metadata
Metadata
Assignees
Labels
enhancementFeature requests and improvementsFeature requests and improvements