1import spacy
2from spacy.matcher import Matcher
3nlp = spacy.load('en-core-web-us')
4matcher = Matcher(nlp.vocab)
5patterns =[[{'LOWER':'hello'}, {'LOWER':'potato'}], [{'LOWER':'hello'}, {'LOWER':'yam'}], [{'LOWER':'hello'}, {'LOWER':'stupid'}]]
6matcher.add('a', patterns, on_match=None)
7document = nlp(u'hello potato i am hello yam you are hello stupid')
8matcher(document)