Skip to content

Instantly share code, notes, and snippets.

@jabirjamal
Created July 23, 2021 11:52
Show Gist options
  • Save jabirjamal/5ac6a863869cfdcc30f2752b96763ff6 to your computer and use it in GitHub Desktop.
Save jabirjamal/5ac6a863869cfdcc30f2752b96763ff6 to your computer and use it in GitHub Desktop.
Customizing lemmatization
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