Back to LanguageTool Homepage - Privacy - Imprint

POS tag matching for XML rules


#1

Hi everyone,

I am trying to write a rule where I am able to check for a recurring POS tag, or rather match a POS tag to one that has already been detected. To make it clearer, here is a snippet from the XML rule, which shows how I would envision using such a feature:

<pattern>
    <token postag="\((ADV|SUB|VER).*\)"  postag_regexp="yes" />             <!-- Take this postag ... -->
    ...
    <token postag="\1 or $1 or match no=1" postag_regexp="yes"/>      <!-- ... and match it here. -->
</pattern>

I have been searching the forums and the development blog, but I can’t seem to find anything that does this. I tried to mess around with ‘unification’, but this doesn’t seem to be working for me at all.

Does anyone know of a way of doing this with an XML rule? And if not, would it be possible to add a way of doing this? Or is it possible to do this kind of thing with a Java rule?

Thanks in advance for your comments!