I am working on spacy and need to find some information like email, phone number and multiple values from text. Below is my code. However there is something which I am doing wrong in matcher, due to which I am not getting desired output. Below is the code.
import spacy
nlp = spacy.load("en_core_web_sm")
from spacy.matcher import Matcher
matcher = Matcher(nlp.vocab)
my_pattern = [{"LOWER": "email"}, {"LOWER": "phone"}]
matcher.add('MyPattern', [my_pattern])
my_text = "email: kashif.jilani@sample.com, phone: 1234567"
my_doc = nlp(my_text)
desired_matches = matcher(my_doc)
for match_id, start, end in desired_matches:
string_id = nlp.vocab.strings[match_id]
span = my_doc[start:end]
print(span.text)