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

Horof Jar cases #69

Closed linuxscout closed 2 years ago

linuxscout commented 2 years ago

Problem: implement cases like of dual or plural nouns after Horof Jar: في الكتابان في الغابران

Implemented in XML, but don't work.

linuxscout commented 2 years ago

Solved.

Dual

      <rule id="grammar_0000_jar_dual" name="جار ومجرور للمثنى">
        <antipattern> 
            <!--       حالة المثنى المنصوب أو المجرور أو الجمع المشابه له مثل فلاحين، كاتبين-->
          <token regexp="yes">&horof_jar;</token>
          <token postag="N.*;.?2[IA].?;--.*|N.*;M[3]I.?;--.*" postag_regexp="yes"/>
        </antipattern>
        <antipattern>
                        <!--       حالة المثنى المنصوب أو المجرور أو الجمع المشابه له عند اتصاله بضمير مثل فلاحيّ، كاتبيه-->

          <token regexp="yes">&horof_jar;</token>
          <token postag="N.*;.?2..?;--H|N.*;M[3]I.?;--H" postag_regexp="yes"/>
        </antipattern>
        <pattern>
            <marker>
            <token regexp="yes">&horof_jar;</token>
            <token postag="N.*;.?2[^IA].?;--.*" postag_regexp="yes"/>
          </marker>
       </pattern>
        <message>انتبه لحرف الجر فالمثنى يجر بالياء 

       <suggestion><match no="1"/>&nbsp;<match no="2" postag="(N.*;[MF]2)([^IA])(.*)" postag_replace="$1A$3" postag_regexp="yes"/></suggestion>
        </message>
        <example correction="في الغابرين" type="incorrect"> عجوزا <marker>في الغابران</marker>.</example>
        <example correction="في الكتابين" type="incorrect"> نظرت <marker>في الكتابان</marker>.</example>
        <example correction="في صفحتين" type="incorrect"> نظرت <marker>في صفحتان</marker>.</example>
        <example  type="correct"> نظرت في صفحتين.</example>
        <example  type="correct"> نظرت في الصفحتين.</example>
        <example  type="correct"> قرأت في كتابيها.</example>
        <example  type="correct"> قرأت في كتابي.</example>
        <example  type="correct"> نظرت والصفحتان.</example>
      </rule>

Plural

   <rule id="grammar_0000_jar_plural" name="جار ومجرور  للجمع">
        <antipattern> 
            <!--       حالة  جمع المذكر السالم المنصوب أو المجرور أو المثنى المشابه المشابه له مثل فلاحين، كاتبين-->
          <token regexp="yes">&horof_jar;</token>
          <token postag="N.*;.?2[IA].?;--.*|N.*;M[3]I.?;--.*" postag_regexp="yes"/>
        </antipattern>
        <antipattern>
                        <!--       حالة  جمع المذكر السالم المنصوب أو المجرور أو المثنى المشابه المشابه له عند اتصاله بضمير مثل فلاحيّ، كاتبيه-->

          <token regexp="yes">&horof_jar;</token>
          <token postag="N.*;.?2..?;--H|N.*;M[3]I.?;--H" postag_regexp="yes"/>
        </antipattern>
        <pattern>
            <marker>
            <token regexp="yes">&horof_jar;</token>
            <token postag="N.*;M3[^IA].?;--.*" postag_regexp="yes"/>
          </marker>
       </pattern>
        <message>:انتبه لحرف الجر فالجمع المذكر السالم  يُجَرّ بالياء 
       <suggestion><match no="1"/>&nbsp;<match no="2" postag="(N.*;[MF]3)([^IA])(.*)" postag_replace="$1I$3" postag_regexp="yes"/></suggestion>
        </message>
        <example correction="في الغابرين" type="incorrect"> عجوزا <marker>في الغابرون</marker>.</example>
        <example correction="في العائدين" type="incorrect"> نظرت <marker>في العائدون</marker>.</example>
        <example correction="في صادقين" type="incorrect"> نظرت <marker>في صادقون</marker>.</example>
        <example  type="correct"> نظرت في صفحتين.</example>
        <example  type="correct"> نظرت في الصفحتين.</example>
        <example  type="correct"> قرأت في فلاحيها.</example>
        <example  type="correct"> قرأت في كاتبي.</example>
        <example  type="correct"> نظرت والمدرسون.</example>
        <example correction="إلى مسافرين" type="incorrect"> هرولت <marker>إلى مسافرون</marker>.</example>
        <example correction="مع المسافرين" type="incorrect"> عجوزا <marker>مع المسافرون</marker>.</example>
      </rule>