Skip to content

Does not match non-negated prhases, with "+", "?" or "!" operator as first token #5538

Discussion options

You must be logged in to vote

I think the problem is some confusion about the definition of the quantifiers. ! in particular can cause some confusion and I think the docs could be improved a bit here.

{"OP": "!"} matches exactly one negated token and won't match if no token is present in that position in the pattern. It can't be used to match 0 tokens.

{"OP": "?"} can match 0 or 1 tokens, so you're see some matches on part of the text, like just the word fake rather than the whole text. If you only want matches that cover the whole text, you'll have to filter the matches (the on_match callback is an easy place to do this).

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ines
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feat / matcher Feature: Token, phrase and dependency matcher
2 participants
Converted from issue

This discussion was converted from issue #5538 on December 11, 2020 00:17.