Repository navigation
Can we add other regex quantifiers to the rule-based matching? #6294
|
Hello and thanks again for this amazing package. I was trying to extract The issue is that as you can see in the second example, Unfortunately, in a real-life setting, it is hard to know in advance how many tokens there could be between a lemma of interest (here, For instance: Can we do better here? For instance, you could add a regex quantifier that says Thanks! |
Replies: 5 comments
|
There's an open issue for quantifiers in matcher patterns: #5603. (We would welcome a PR!) However, if you want to detect VPs, you'd be better off working with the tags plus the dependency parses, similar to how the noun chunks detection is implemented, e.g.: https://github.com/explosion/spaCy/blob/260c29794a1caa70f8b0702c31fcfecad6bfdadc/spacy/lang/en/syntax_iterators.py You could also try out the new |
|
Thanks @adrianeboyd this is very useful! I will check the dependency parser then. Right now, I was parsing the dependency tree manually using the Just a quick question maybe. I do not understand why you use How is this preventing nested noun chunks? I though a simple algorithm would have been to look for |
|
In addition, I do not understand why (in Spacy v3) we are using the concept of Thanks again for all the great work!! |
|
You could write |
|
thanks for clarifying that. super useful! |
There's an open issue for quantifiers in matcher patterns: #5603. (We would welcome a PR!)
However, if you want to detect VPs, you'd be better off working with the tags plus the dependency parses, similar to how the noun chunks detection is implemented, e.g.: https://github.com/explosion/spaCy/blob/260c29794a1caa70f8b0702c31fcfecad6bfdadc/spacy/lang/en/syntax_iterators.py
You could also try out the new
DependencyMatcherthat will be in the upcoming spacy v3 release. Installspacy-nightly(in a new venv!) to try it out: https://github.com/explosion/spaCy/blob/260c29794a1caa70f8b0702c31fcfecad6bfdadc/spacy/lang/en/syntax_iterators.py