spacy.matcher code example
Example: spacy matcher syntax
import spacy
from spacy.matcher import Matcher
nlp = spacy.load('en-core-web-us')
matcher = Matcher(nlp.vocab)
patterns =[[{'LOWER':'hello'}, {'LOWER':'potato'}], [{'LOWER':'hello'}, {'LOWER':'yam'}], [{'LOWER':'hello'}, {'LOWER':'stupid'}]]
matcher.add('a', patterns, on_match=None)
document = nlp(u'hello potato i am hello yam you are hello stupid')
matcher(document)