Back to LanguageTool Homepage - Privacy - Imprint

Bitext rule appears to return wrong position values for tox, toy, fromx, and fromy


(Jörg Beisiegel) #1

Hello,
I am experiencing Problems using bitext rules together with Rainbow CheckMate (v 0.26 and latest 0.27 Snapshot). The error markup does not work and the error "Error while updating table. Index out of bounds." is thrown when I click to open the entry. I have reproduced this behavior with v. 2.7 and 2.8, latest snapshot.

First I suspected my rules to be wrong and / or uncomplete, so I did some further testing. The rulechecks for German grammar and bitext files returned no errors.

The rule is the following:

<rule name="Bitext Test">


    <rule lang="de" id="BITEXT_TEST_XXXY" name="Bitext Test XXXY">    
        <pattern>
          <source lang="en">
            <token>XXXX</token>
          </source>
          <target>
            <marker>
              <token>XXXY</token>
            </marker>
          </target>
        </pattern>
        <message>Meinten Sie etwa <suggestion><match no="1" regexp_match="^(XXX)Y" regexp_replace="$1X"/></suggestion>?</message>
        <example type="incorrect" correction="XXXX">
          <srcExample><marker>XXXX</marker> was meant.</srcExample>
          <trgExample>Es war <marker>XXXY</marker> gemeint.</trgExample>
        </example>
        <example type="correct">
          <srcExample><marker>XXXX</marker> was meant.</srcExample>
          <trgExample>Es war <marker>XXXX</marker> gemeint.</trgExample>
        </example>
           </rule>

</category>

The xliff file to check is:

<?xml version="1.0" encoding="utf-8"?>




XXXX was meant.
Es war XXXY gemeint.
a


To get more details I started the equivalent http query:
http://localhost:8081/?&motherTongue=en&srctext=XXXX+was+meant.&language=de&text=Es+war+XXXY+gemeint.&enabledonly=no

I get the following answer:

The reason for the CheckMate error appear to be the invalid values for fromy, fromx, toy,and tox.

I then converted the same rule into a simple German Grammar rule:

    <rule id="GRAMMAR_TEST_XXXY" name="Grammar Test XXXY">    
          <pattern>
            <marker>
              <token>XXXY</token>
            </marker>
          </pattern>
          <message>Meinten Sie etwa <suggestion><match no="1" regexp_match="^(XXX)Y" regexp_replace="$1X"/></suggestion>?</message>
          <example type="incorrect" correction="XXXX">
            <Example>Es war <marker>XXXY</marker> gemeint.</Example>
          </example>
          <example type="correct">
            <Example>Es war <marker>XXXX</marker> gemeint.</Example>
          </example>
            </rule>

  </category>

The same http query returns correct position values:

Am I missing some information that has to be added to the bitext rule?

Thanks in advance


(milek_pl) #2

Hello,

this is a bug. Please add an issue here:

https://github.com/languagetool-org/languagetool/issues

Thanks,
Marcin


(Jörg Beisiegel) #3

Hello Marcin,
thank you very much for checking and for confirming my suspect.
I have added an issue at github as per your suggestion.

Regards,
Jörg