Spacy has two features I\'d like to combine - part-of-speech (POS) and rule-based matching.
How can I combine them in a neat way?
For example - let\'s say i
Sure, simply use the POS attribute.
import spacy nlp = spacy.load('en') from spacy.matcher import Matcher from spacy.attrs import POS matcher = Matcher(nlp.vocab) matcher.add_pattern("Adjective and noun", [{POS: 'ADJ'}, {POS: 'NOUN'}]) doc = nlp(u'what are the main issues') matches = matcher(doc)