I was reproducing a Spacy rule-matching example:
import spacy
from spacy.matcher import Matcher
nlp = spacy.load("en_core_web_md")
doc = nlp("Good morning, I'm here. I'll say good evening!!")
pattern = [{"LOWER": "good"},{"LOWER": {"IN": ["morning", "evening"]}},{"IS_PUNCT": True}]
matcher.add("greetings", [pattern]) # good morning/evening with one pattern with the help of IN as follows
matches = matcher(doc)
for mid, start, end in matches:
print(start, end, doc[start:end])
which is supposed to match
Good morning good evening!
But the above code also matches "I" in both occasions
0 3 Good morning,
3 4 I
7 8 I
10 13 good evening!
I just want to remove the "I" from the Matching
Thank you