Pattern Matcher: Options to exclude phrases #6448
Replies: 2 comments
-
|
I could be mistaken, but I think you're right that the current matcher does not offer this functionality. There are some related feature requests, such as #2262 which is a little less complex than what you're describing. In general I think we'd be happy to accept contributions to enhance the functionality in the |
Beta Was this translation helpful? Give feedback.
-
|
@ik4Rus Perhaps you can do something like this: |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
first of all thank you very much for the amazing package and the fantastic documentation. :)
I didn't find a solution for the following challenge and I'm not sure if it would be a new feature or I didn't find it in the documentation.
Minimal example
Using rule-based matching I would like to find all patterns, where the lemma 'house' occurs, except the lemma 'in' occurs in any token before it:
Expected:
I love the house. - match
I am in the house. - no match
We were playing in their great house. - no match
(Not working) approach
Patterns like [{'LEMMA': {'NOT_IN': ['in']}}, {'OP': '*'}, {'LEMMA': 'house'}] do not work, because then e.g. 'the' matches {'LEMMA': {'NOT_IN': ['in']}}}.
Related documentation
I did not find anything in the documentation (https://spacy.io/usage/rule-based-matching#_title) and forums.
Thank you :)
Beta Was this translation helpful? Give feedback.
All reactions