Is it possible to do longest match in PhraseMatcher? #7301
Replies: 3 comments
-
I don't think there is a direct way to do this with the The |
Beta Was this translation helpful? Give feedback.
-
Thanks. Longest match should be the behavior for lexicon entry matching. |
Beta Was this translation helpful? Give feedback.
-
(Maintenance note: this question is well suited for the discussions forum, so I'm moving it there. While it looks like this issue gets closed, in fact the linked discussion thread will remain open to continue the conversation) |
Beta Was this translation helpful? Give feedback.
-
matcher = PhraseMatcher(nlp.vocab, attr = 'LOWER')
Is there one option to only return longest match? For example:
In dictionary:
And the incoming sentence is:
This is a test.
The current phrase matcher returns both 'test' and 'a test' as matched offsets. May I only get the longest match 'a test' as the returned match, instead of both?
Beta Was this translation helpful? Give feedback.
All reactions