sohaibafifi / languagetool

A fork of languagetool to maintain Arabic
https://languagetool.org
GNU Lesser General Public License v2.1
18 stars 1 forks source link

Recursive error case #22

Closed linuxscout closed 4 years ago

linuxscout commented 4 years ago

Salam, I want to represent the following error case. the word “سيّما” must be preceded by the word “لا”,

<pattern>
<marker>
 <token negate="yes" regexp="yes">لا|ولا</token>
 <token>سيما</token>
</marker>
</pattern>
<message>must be preceded by "لا:
        <suggestion>لا سيّما</suggestion>
</message>

but I got recursive error. How to represent this case?

linuxscout commented 4 years ago

I posted the issue into LT forum

dnaber responded I’m not sure I understand your case, but maybe you could use to avoid matches not desired? There’s documentation at http://wiki.languagetool.org/development-overview#toc15

linuxscout commented 4 years ago

I used anti pattern as shown in forum

    <rule id ='unsorted357' name='سيما_357'>
     <antipattern>
      <token regexp="yes">لا|ولا</token>
      <token>سيما</token>
     </antipattern>
     <pattern>
      <marker><token>سيما</token>
      </marker>
     </pattern>
      <message>يفضل أن يقال: 
         <suggestion>لا سيّما</suggestion>
      </message>
      <example correction='لا سيّما' type='incorrect'>سأحقق ما تريد <marker>سيما</marker> الراتب</example>
<example type='correct'> سأحقِّقُ ما تريد ولا سيّما../سأحقِّقُ ما تريد لا سيّما.. </example>
    </rule>

It works.