Created
July 23, 2021 08:55
-
-
Save jabirjamal/b12607ad906d90c3ff52bc65613e1e90 to your computer and use it in GitHub Desktop.
custom tokenizer
This file contains hidden or 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
doc = nlp("gimme that book") | |
print([w.text for w in doc]) | |
from spacy.symbols import ORTH | |
special_case = [{ORTH: "gim"}, {ORTH: "me"}] | |
nlp.tokenizer.add_special_case("gimme", special_case) | |
print([w.text for w in doc]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment