Is there an OR operator in spaCy's Matcher patterns?
0
Using spaCy 2.x, how to extract noun phrases based on parts of speech? I want to use patterns with spaCy's Matcher but combinations are too many to create them manually. Indeed, in my logic, a noun phrase is a group of one or many tokens that: must end with a NOUN token can also contain zero, one or many ADJ, PROPN, NOUN tokens in any order before the ending NOUN token For example: NOUN ADJ NOUN NOUN ADJ ADJ NOUN NOUN Is there an "OR" operator so I could use a pattern such as the below (using an array of matching POS, for example)? matcher.add( 'NounPhrases', None, [ {'POS': ['ADJ','NOUN','PROPN'], 'OP': '*'}, {'POS': 'NOUN'} ] )