Created
July 23, 2021 11:52
-
-
Save jabirjamal/5ac6a863869cfdcc30f2752b96763ff6 to your computer and use it in GitHub Desktop.
Customizing lemmatization
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spacy | |
nlp = spacy.load('en_core_web_md') | |
nlp.get_pipe('attribute_ruler').add([[{"TEXT":"Angeltown"}]],{"LEMMA":"San Fransisco"}) | |
doc = nlp(u'I am flying to Angeltown') | |
for token in doc: | |
print(token.text, token.lemma_) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment