Closed educatorsRlearners closed 3 years ago
Like the title says, the example on pages 46 and 47 throws an error if you are using spaCy 3.0 as described here.
To that end, I changed the code using the template provided here like this:
import spacy nlp = spacy.load('en_core_web_md') nlp.get_pipe("attribute_ruler").add([[{"TEXT": "Angeltown"}]], {"LEMMA": "Los Angeles"}) doc = nlp("I am flying to Angeltown.") for token in doc: print(token.text, token.lemma_)
and got the desired output.
I wrote some chapters before v3. I made a second pass to the code after v3 came out, some of the code might have escaped from my attention. Thanks for reporting!
Like the title says, the example on pages 46 and 47 throws an error if you are using spaCy 3.0 as described here.
To that end, I changed the code using the template provided here like this:
and got the desired output.