Created
August 23, 2022 21:43
-
-
Save ahmedbesbes/222b5efa912c30f42e60dfdc323479b7 to your computer and use it in GitHub Desktop.
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
from spacy.matcher import Matcher | |
nlp = spacy.load("en_core_web_sm") | |
doc = nlp("Hello my friend!") | |
pattern = [ | |
{"TEXT": "Hello"} | |
] | |
matcher = Matcher(nlp.vocab) | |
matcher.add("HelloPattern", [pattern]) | |
matcher(doc) | |
[(10496072603676489703, 0, 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment