Я думаю, что вы ищете соответствие на основе правил .Ваш код будет выглядеть примерно так:
import spacy
from spacy.matcher import Matcher
nlp = spacy.load("en_core_web_sm")
list_of_rules = [
["VERB", "ADJ", "NOUN"],
["NOUN", "VERB", "ADV"],
["NOUN", "ADP", "NOUN"],
# more rules here...
]
rules = [[{"POS": i} for i in j] for j in list_of_rules]
matcher = Matcher(nlp.vocab)
matcher.add("rules", None, *rules)
doc = nlp("Education of children was our revenue earning secondary business.")
matches = matcher(doc)
print([doc[start:end].text for _, start, end in matches])
, что будет печатать
['Education of children', 'earning secondary business']