Exception scope previous vs next

I often need to have a negative condition if the previous/next token matches something.
It’s very easy to do it currently with scope=“previous”, e.g.

      <token regexp="yes" inflected="yes" postag_regexp="yes">більше?|більший
        <exception scope="previous">не</exception>

but I can’t do that with scope=“next” (as “next” requires “skip” in previous token and “skip” is >=1).
Sometimes I can just insert token after, but often my main token is the last one in the sentence and if there’s no period at the end of the sentence (I must say this happens much more often than I would like) extra token breaks the pattern.
The only workaround I found for now is to use antipattern but it’s bulky and slower for simple next condition (often I have to repeat condition in my main token). The other problem is that antipattern are not supported in disabmiguator.xml.

Is there a good way for optional negated token after another token I am missing? Or shall we allow scope=“next” without previous “skip”?


I sometimes use following tokens after token with scope=“next”:

<token regexp="yes">[.,:;!?]</token>


<token postag="SENT_END" />

Yes, but the problem is if your token with exception for the next is the last token in the sentence (no ending dot) putting additional token after it will break the match.

Here’s the patch that allows to have scope=“next” in the exception without skip="" in the the token. All tests pass with this change.
If there are no objections, I’ll test it a bit more and will push it in.
allow_scope_next_without_skip.zip (1.1 KB)

P.S. looks like forum does not allow attaching .patch so I had to zip it in