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

<section-def-cats>
  <def-cat n="nom">
     <cat-item tags="n.*"/>
     <cat-item tags="np.*"/>
  </def-cat>
  <def-cat n="n">
     <cat-item tags="n.*"/>
  </def-cat>
  <def-cat n="np">
     <cat-item tags="np.*"/>
  </def-cat>
  <def-cat n="num">
     <cat-item tags="num"/>
     <cat-item tags="num.*"/>
  </def-cat>
  <def-cat n="vblex">
     <cat-item tags="vblex.*"/>
  </def-cat>
  <def-cat n="perfpres">
    <cat-item tags="vblex.*.perf.*.pres.*"/>
    <cat-item tags="vbmod.*.perf.*.pres.*"/>
    <cat-item tags="vbser.*.perf.*.pres.*"/>
    <cat-item tags="vbhaver.*.perf.*.pres.*"/>
  </def-cat>
  <def-cat n="ipp">
    <cat-item tags="vblex.impf.*.pp.adv"/>
    <cat-item tags="vbmod.impf.*.pp.adv"/>
    <cat-item tags="vbser.impf.*.pp.adv"/>
    <cat-item tags="vbhaver.impf.*.pp.adv"/>
  </def-cat>
  <def-cat n="pprs_pasv">
     <cat-item tags="vblex.*.pprs.pasv.*"/>
     <cat-item tags="vbhaver.*.pprs.pasv.*"/>
     <cat-item tags="vbser.pprs.pasv.*"/>
     <cat-item tags="vbmod.*.pprs.pasv.*"/>
  </def-cat>
  <def-cat n="pp_pasv">
     <cat-item tags="vblex.*.pp.pasv.*"/>
     <cat-item tags="vbhaver.*.pp.pasv.*"/>
     <cat-item tags="vbser.pp.pasv.*"/>
     <cat-item tags="vbmod.*.pp.pasv.*"/>
  </def-cat>
  <def-cat n="pp_actv">
     <cat-item tags="vblex.*.pp.actv.*"/>
     <cat-item tags="vbhaver.*.pp.actv.*"/>
     <cat-item tags="vbser.pp.actv.*"/>
     <cat-item tags="vbmod.*.pp.actv.*"/>
  </def-cat>
  <def-cat n="pprs_actv">
     <cat-item tags="vblex.*.pprs.actv.*"/>
     <cat-item tags="vbhaver.*.pprs.actv.*"/>
     <cat-item tags="vbser.pprs.actv.*"/>
     <cat-item tags="vbmod.*.pprs.actv.*"/>
  </def-cat>
  <def-cat n="prn">
     <cat-item tags="prn.*"/>
  </def-cat>
  <def-cat n="adj">
     <cat-item tags="adj.*"/>
  </def-cat>
  <def-cat n="pr">
     <cat-item tags="pr"/>
  </def-cat>
  <def-cat n="det">
     <cat-item tags="det"/>
     <cat-item tags="det.*"/>
  </def-cat>
  <def-cat n="prefix-adj">
     <cat-item tags="pref.adj"/>
     <cat-item tags="pref.adj.*"/>
  </def-cat>
  <def-cat n="adj_det">
     <cat-item tags="adj.*"/>
     <cat-item tags="det"/>
     <cat-item tags="det.*"/>
  </def-cat>
  <def-cat n="adj_short">
     <cat-item tags="adj.*.short"/>
     <cat-item tags="adj.*.short.*"/>
     <cat-item tags="adj.short.*"/>
  </def-cat>
  <def-cat n="exp">
     <cat-item tags="part.exp"/>
  </def-cat>

</section-def-cats>

<section-def-attrs>
  <def-attr n="a_n">
     <attr-item tags="n"/>
  </def-attr>

  <def-attr n="a_np">
     <attr-item tags="np"/>
     <attr-item tags="np.ant"/>
     <attr-item tags="np.al"/>
     <attr-item tags="np.org"/>
     <attr-item tags="np.hyd"/>
     <attr-item tags="np.top"/>
     <attr-item tags="np.cog"/>
  </def-attr>

  <def-attr n="a_prp">
     <attr-item tags="pr"/>
  </def-attr>

  <def-attr n="a_adj">
     <attr-item tags="adj"/>
     <attr-item tags="adj.pve"/>
     <attr-item tags="adj.comp"/>
     <attr-item tags="adj.sup"/>
     <attr-item tags="adj.itg"/>
     <attr-item tags="adj.sint.comp"/>
  </def-attr>

  <def-attr n="a_cmp">
     <attr-item tags="cmp"/>
  </def-attr>

  <def-attr n="a_vrb">
     <attr-item tags="vblex"/>
     <attr-item tags="vbmod"/>
     <attr-item tags="vbser"/>
     <attr-item tags="vbhaver"/>
  </def-attr>

  <def-attr n="a_short">
     <attr-item tags="short"/>
  </def-attr>

  <def-attr n="asp">
     <attr-item tags="impf"/>
     <attr-item tags="dual"/>
     <attr-item tags="perf"/>
  </def-attr>

  <def-attr n="trans">
     <attr-item tags="tv"/>
     <attr-item tags="iv"/>
  </def-attr>

  <def-attr n="a_prn">
     <attr-item tags="prn"/>
     <attr-item tags="prn.itg"/>
  </def-attr>

  <def-attr n="tns">
     <attr-item tags="inf"/>
     <attr-item tags="pp.pasv"/>
     <attr-item tags="pp.actv"/>
     <attr-item tags="pp.adv"/>
     <attr-item tags="pprs.pasv"/>
     <attr-item tags="pprs.actv"/>
     <attr-item tags="pprs.adv"/>
     <attr-item tags="fut"/>
     <attr-item tags="pres"/>
     <attr-item tags="imp"/>
     <attr-item tags="past"/>
     <attr-item tags="nonpast"/>
  </def-attr>

  <def-attr n="a_fac">
     <attr-item tags="fac"/>
  </def-attr>

  <def-attr n="a_pass">
     <attr-item tags="pass"/>
  </def-attr>


  <def-attr n="gen">
     <attr-item tags="m"/>
     <attr-item tags="f"/>
     <attr-item tags="nt"/>
     <attr-item tags="mf"/>
     <attr-item tags="mfn"/>
     <attr-item tags="AG"/>
  </def-attr>

  <def-attr n="prs">
     <attr-item tags="p1"/>
     <attr-item tags="p2"/>
     <attr-item tags="p3"/>
  </def-attr>

  <def-attr n="anim">
     <attr-item tags="nn"/>
     <attr-item tags="aa"/>
     <attr-item tags="an"/>
  </def-attr>


  <def-attr n="nbr">
     <attr-item tags="sg"/>
     <attr-item tags="pl"/>
     <attr-item tags="AN"/>
  </def-attr>

  <def-attr n="cas">
     <attr-item tags="nom"/>
     <attr-item tags="acc"/>
     <attr-item tags="dat"/>
     <attr-item tags="gen"/>
     <attr-item tags="loc"/>
     <attr-item tags="ins"/>
     <attr-item tags="voc"/>
     <attr-item tags="prp"/>
     <attr-item tags="AC"/>
  </def-attr>

  <def-attr n="a_sint">
     <attr-item tags="sint"/>
  </def-attr>

</section-def-attrs>

<section-def-vars>
  <def-var n="number"/>
  <def-var n="genere"/>
</section-def-vars>


<section-def-macros>
  <!-- Case adapter: prp (rus) → loc (ukr) -->
  <!-- nbr adapter: removes extranious numbers created by mandatory bidix pl or sg tags. -->
  <def-macro n="case_adapter1" npar="1">
    <let><clip pos="1" side="tl" part="a_fac"/><lit v=""/></let> <!-- no pass or fac tags exist in belarussian dic -->
    <let><clip pos="1" side="tl" part="a_pass"/><lit v=""/></let>
    <choose>
      <when>
        <test><equal><clip pos="1" side="tl" part="cas"/><lit-tag v="prp"/></equal></test>
        <let><clip pos="1" side="tl" part="cas"/><lit-tag v="loc"/></let>
      </when>
    </choose>
<!--     <choose>
      <when>
        <test>
          <and>
          <equal><clip pos="1" side="tl" part="asp"/><lit-tag v="dual"/></equal>
          <equal><clip pos="1" side="tl" part="tns"/><lit-tag v="pres"/></equal>
        </and>
      </test>
      <let><clip pos="1" side="tl" part="tns"/><lit-tag v="nonpast"/></let>
      </when>
    </choose>
 -->    <choose>
      <when>
        <test>
          <or>
            <equal><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="sg.sg"/></equal>
            <equal><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="sg.pl"/></equal>
          </or>
        </test>
        <let><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="sg"/></let>
      </when>
      <when>
        <test>
          <or>
            <equal><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="pl.sg"/></equal>
            <equal><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="pl.pl"/></equal>
          </or>
        </test>
        <let><clip pos="1" side="tl" part="dbl_nbr"/><lit-tag v="pl"/></let>
      </when>
    </choose>
  </def-macro>

  <!-- Transfer gender, number -->
  <def-macro n="case_adapter_n" npar="2">
    <choose>
      <when>
        <test>
          <and>
            <equal><clip pos="1" side="tl" part="nbr"/><lit-tag v="sg"/></equal>
            <equal><clip pos="2" side="tl" part="nbr"/><lit-tag v="sg"/></equal>
          </and>
        </test>
        <let>
          <clip pos="1" side="tl" part="gen"/>
          <clip pos="2" side="tl" part="gen"/>
        </let>
      </when>
      <when>
        <test>
          <equal><clip pos="2" side="tl" part="nbr"/><lit-tag v="pl"/></equal>
        </test>
        <let>
          <clip pos="1" side="tl" part="nbr"/>
          <clip pos="2" side="tl" part="nbr"/>
        </let>
        <let>
          <clip pos="1" side="tl" part="gen"/>
          <lit-tag v="mfn"/>
        </let>
      </when>
    </choose>
  </def-macro>

  <def-macro n="short" npar="1">
    
    <!-- <choose>
      <when>
        <test><equal><clip pos="1" side="tl" part="anim"/><lit-tag v=""/></equal></test>
        <let><clip pos="1" side="tl" part="anim"/><lit-tag v="an"/></let>
      </when>
    </choose>
    <choose>
      <when>
        <test><equal><clip pos="1" side="tl" part="cas"/><lit-tag v=""/></equal></test>
        <let><clip pos="1" side="tl" part="cas"/><lit-tag v="nom"/></let>
      </when>
    </choose> -->

    <choose>
      <when>
        <test><equal><clip pos="1" side="sl" part="a_cmp"/><lit-tag v="cmp"/></equal></test> 
        <let><clip pos="1" side="sl" part="a_cmp"/><lit-tag v=""/></let>
        <let><clip pos="1" side="tl" part="tags"/><concat><clip pos="1" side="tl" part="tags"/><lit-tag v="m.an.sg.nom"/></concat></let>
      </when>
      <otherwise>
        <let><clip pos="1" side="tl" part="tags"/><concat><lit-tag v="adj"/><clip pos="1" side="sl" part="gen"/><lit-tag v="an"/><clip pos="1" side="sl" part="nbr"/><lit-tag v="nom"/></concat></let>
      </otherwise>
    </choose>
  </def-macro>

</section-def-macros>


<section-rules>
<!-- Sintagmas nominales -->


<rule comment="RULE: их">
    <pattern>
      <pattern-item n="det"/>
      <pattern-item n="nom"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <choose>
        <when>
          <test><equal><clip pos="1" side="sl" part="lemh"/><lit-tag v="их"/></equal></test> <!-- to deal with их trasfer -->
          <let><clip pos="1" side="tl" part="gen"/><clip pos="2" side="tl" part="gen"/></let>
          <let><clip pos="1" side="tl" part="nbr"/><clip pos="2" side="tl" part="nbr"/></let>
          <let><clip pos="1" side="tl" part="cas"/><clip pos="2" side="tl" part="cas"/></let>
        </when>
      </choose>
      <out>
        <chunk name="det" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="DET"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
          <lu>
            <clip pos="2" side="tl" part="whole"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Determiner → Determiner">
    <pattern>
      <pattern-item n="det"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <choose>
        <when>
          <test><equal><clip pos="1" side="sl" part="lemh"/><lit-tag v="их"/></equal></test> <!-- to deal with их trasfer -->
          <let><clip pos="1" side="tl" part="gen"/><lit-tag v="m"/></let>
          <let><clip pos="1" side="tl" part="nbr"/><lit-tag v="sg"/></let>
          <let><clip pos="1" side="tl" part="cas"/><lit-tag v="nom"/></let>
        </when>
      </choose>
      <out>
        <chunk name="det" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="DET"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Numeral → Numeral">
    <pattern>
      <pattern-item n="num"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <out>
        <chunk name="num" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="NUM"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Pronoun → Pronoun">
    <pattern>
      <pattern-item n="prn"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <out>
        <chunk name="prn" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="PRN"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Noun → Noun">
    <pattern>
      <pattern-item n="n"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <out>
        <chunk name="n" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SN"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="lemh"/>
            <clip pos="1" side="tl" part="tags"/>
            <clip pos="1" side="tl" part="lemq"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Proper Noun → Proper Noun">
    <pattern>
      <pattern-item n="np"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <out>
        <chunk name="np" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SN"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="lemh"/>
            <clip pos="1" side="tl" part="a_np"/>
            <clip pos="1" side="tl" part="gen"/>
            <clip pos="1" side="tl" part="nbr"/>
            <clip pos="1" side="tl" part="cas"/>
            <clip pos="1" side="tl" part="lemq"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

<rule comment="RULE: Present passive participle → Past passive participle">
    <pattern>
      <pattern-item n="pprs_pasv"/>
    </pattern>
    <action>
      <choose>
        <when>
          <test><equal><clip pos="1" side="sl" part="a_short"/><lit-tag v="short"/></equal></test>
          <let><clip pos="1" side="tl" part="tags"/><concat><clip pos="1" side="tl" part="a_vrb"/><clip pos="1" side="tl" part="asp"/>
          <clip pos="1" side="tl" part="trans"/><clip pos="1" side="tl" part="gen"/><lit-tag v="an"/><clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="nom"/></concat></let>        
        </when>
      </choose>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <!-- <call-macro n="short"><with-param pos="1"/></call-macro> -->
       <out>
        <chunk name="prtcpl" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SA"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="lemh"/>
            <clip pos="1" side="tl" part="a_vrb"/>
            <clip pos="1" side="tl" part="asp"/>
            <clip pos="1" side="tl" part="trans"/>
            <lit-tag v="pp.pasv"/>
            <clip pos="1" side="tl" part="gen"/>
            <clip pos="1" side="tl" part="anim"/>
            <clip pos="1" side="tl" part="nbr"/>
            <clip pos="1" side="tl" part="cas"/>
            <clip pos="1" side="tl" part="lemq"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Present active participle → Pronoun 'як' + Verb">
    <pattern>
      <pattern-item n="pprs_actv"/>
    </pattern>
    <action>
      <choose>
        <when>
          <test><equal><clip pos="1" side="tl" part="asp"/><lit-tag v="dual"/></equal></test>
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="nonpast"/></let>
          <let><clip pos="1" side="tl" part="whole"/><concat><clip pos="1" side="tl" part="whole"/><lit-tag v="p3"/></concat></let>        
        </when>
        <otherwise>
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="pres"/></let>
          <let><clip pos="1" side="tl" part="whole"/><concat><clip pos="1" side="tl" part="whole"/><lit-tag v="p3"/></concat></let>
        </otherwise> 
      </choose>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <out>
        <chunk name="pprs_actv" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SRel"/></tag>
          </tags>
             <lu>
                 <lit v="котрий"/>
                 <lit-tag v="det.itg"/>
                 <clip pos="1" side="tl" part="gen"/>
                 <clip pos="1" side="tl" part="anim"/>
                 <clip pos="1" side="tl" part="nbr"/>
                 <clip pos="1" side="tl" part="cas"/>
             </lu>
             <b/>
             <lu>
                <clip pos="1" side="tl" part="lemh"/>
                <clip pos="1" side="tl" part="a_vrb"/>
                <clip pos="1" side="tl" part="asp"/>
                <clip pos="1" side="tl" part="trans"/>
                <clip pos="1" side="tl" part="tns"/>
                <clip pos="1" side="tl" part="prs"/>
<!--                 <lit-tag v="pres.p3"/> -->
                <clip pos="1" side="tl" part="nbr"/>
                <clip pos="1" side="tl" part="lemq"/>
             </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Past active participle → Pronoun 'як' + Verb">
    <pattern>
      <pattern-item n="pp_actv"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>

      <out>
        <chunk name="pp_actv" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SRel"/></tag>
          </tags>
             <lu>
                 <lit v="котрий"/>
                 <lit-tag v="det.itg"/>
                 <clip pos="1" side="tl" part="gen"/>
                 <clip pos="1" side="tl" part="anim"/>
                 <clip pos="1" side="tl" part="nbr"/>
                 <clip pos="1" side="tl" part="cas"/>
             </lu>
             <b/>
             <lu>
                <clip pos="1" side="tl" part="lemh"/>
                <clip pos="1" side="tl" part="a_vrb"/>
                <clip pos="1" side="tl" part="asp"/>
                <clip pos="1" side="tl" part="trans"/>
                <lit-tag v="past"/>
                <clip pos="1" side="tl" part="gen"/>
                <clip pos="1" side="tl" part="nbr"/>
                <clip pos="1" side="tl" part="lemq"/>
             </lu>
        </chunk>
      </out>
    </action>
  </rule>


<rule comment="RULE: Past active participle + Noun → {Pronoun 'котрий' + Verb} + {Noun}, transfer noun's gender to verb">
    <pattern>
      <pattern-item n="pp_actv"/>
      <pattern-item n="nom"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <call-macro n="case_adapter1"><with-param pos="2"/></call-macro>
      <call-macro n="case_adapter_n"><with-param pos="1"/><with-param pos="2"/></call-macro>
      <out>
        <chunk name="pp_actv" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SRel"/></tag>
          </tags>
             <lu>
                 <lit v="котрий"/>
                 <lit-tag v="det.itg"/>
                 <clip pos="1" side="tl" part="gen"/>
                 <clip pos="1" side="tl" part="anim"/>
                 <clip pos="1" side="tl" part="nbr"/>
                 <clip pos="1" side="tl" part="cas"/>
             </lu>
             <b/>
             <lu>
                <clip pos="1" side="tl" part="lemh"/>
                <clip pos="1" side="tl" part="a_vrb"/>
                <clip pos="1" side="tl" part="asp"/>
                <clip pos="1" side="tl" part="trans"/>
                <lit-tag v="past"/>
                <clip pos="1" side="tl" part="gen"/>
                <clip pos="1" side="tl" part="nbr"/>
                <clip pos="1" side="tl" part="lemq"/>
             </lu>
        </chunk>
        <chunk name="nom" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SN"/></tag>
          </tags>
             <lu>
                <clip pos="2" side="tl" part="whole"/>
             </lu>
        </chunk>
      </out>
    </action>
  </rule>



<rule comment="RULE: Verb → Verb">
    <pattern>
      <pattern-item n="vblex"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <choose>
        <when>
          <test>
            <and>
              <equal><clip pos="1" side="sl" part="a_short"/><lit-tag v="short"/></equal>
              <equal><clip pos="1" side="sl" part="tns"/><lit-tag v="pp.pasv"/></equal>
            </and>
          </test>
          <let><clip pos="1" side="tl" part="tags"/><concat><clip pos="1" side="tl" part="a_vrb"/><clip pos="1" side="tl" part="asp"/>
          <clip pos="1" side="tl" part="trans"/><lit-tag v="pp.pasv"/><clip pos="1" side="tl" part="gen"/><lit-tag v="an"/><clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="nom"/></concat></let>        
        </when>
      </choose>
      <choose>
        <when>
          <test>
            <and>
              <equal><clip pos="1" side="tl" part="asp"/><lit-tag v="impf"/></equal>
              <equal><clip pos="1" side="tl" part="tns"/><lit-tag v="fut"/></equal>
            </and>
          </test>          
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="pres"/></let>
        </when>
        <when>
          <test>
            <and>
              <equal><clip pos="1" side="tl" part="asp"/><lit-tag v="perf"/></equal>
              <equal><clip pos="1" side="tl" part="tns"/><lit-tag v="pres"/></equal>
            </and>
          </test>          
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="fut"/></let>
        </when>
        <when>
          <test>
            <and>
              <equal><clip pos="1" side="tl" part="asp"/><lit-tag v="perf"/></equal> <!-- temp solution -->
              <equal><clip pos="1" side="tl" part="tns"/><lit-tag v="pprs.adv"/></equal>
            </and>
          </test>          
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="pp.adv"/></let>
        </when>
        <when>
          <test>
            <and>
              <equal><clip pos="1" side="tl" part="asp"/><lit-tag v="impf"/></equal> <!-- temp solution -->
              <equal><clip pos="1" side="tl" part="tns"/><lit-tag v="pp.adv"/></equal>
            </and>
          </test>          
          <let><clip pos="1" side="tl" part="tns"/><lit-tag v="pprs.adv"/></let>
        </when>
      </choose>
      <out>
        <chunk name="vb" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SV"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="lemh"/>
            <clip pos="1" side="tl" part="tags"/>
            <clip pos="1" side="tl" part="lemq"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>


  <rule comment="RULE: Short adjective → Adjective">
     <pattern>
       <pattern-item n="adj_short"/>
     </pattern>
     <action>
      <choose>
        <when>
          <test><equal><clip pos="1" side="sl" part="a_cmp"/><lit-tag v="cmp"/></equal></test> 
          <let><clip pos="1" side="tl" part="a_cmp"/><lit-tag v=""/></let>
          <let><clip pos="1" side="tl" part="whole"/><concat><clip pos="1" side="tl" part="whole"/><lit-tag v="m.an.sg.nom"/></concat></let>
        </when>
<!--         <when>
          <test><equal><clip pos="1" side="sl" part="a_sint"/><lit-tag v="sint"/></equal></test> 
          <let><clip pos="1" side="tl" part="whole"/><concat><lit-tag v="adj"/><lit-tag v="sint"/><clip pos="1" side="sl" part="gen"/><lit-tag v="an"/><clip pos="1" side="sl" part="nbr"/><lit-tag v="nom"/></concat></let>
        </when> -->
        <otherwise>
          <let><clip pos="1" side="tl" part="tags"/><concat><lit-tag v="adj"/><clip pos="1" side="sl" part="gen"/><lit-tag v="an"/><clip pos="1" side="sl" part="nbr"/><lit-tag v="nom"/></concat></let>
        </otherwise>
      </choose>
     <out>
         <chunk name="adj" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="SA"/></tag>
           </tags>
           <lu>
              <clip pos="1" side="tl" part="whole"/>
           </lu>
         </chunk>
     </out>
     </action>
  </rule>

  <rule comment="RULE: Adjective → Adjective">
    <pattern>
      <pattern-item n="adj"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <choose>
        <when>
          <test><equal><clip pos="1" side="sl" part="a_adj"/><lit-tag v="adj.sint.comp"/></equal></test>
          <!-- <let><clip pos="1" side="tl" part="a_sint"/><lit v=""/></let> -->
          <let><clip pos="1" side="tl" part="whole"/><concat><clip pos="1" side="tl" part="whole"/><lit-tag v="m.an.sg.nom"/></concat></let>
        </when>
      </choose>
      <choose>
        <when>
          <test>
            <and><equal><clip pos="1" side="tl" part="gen"/><lit-tag v="f"/></equal>
            <equal><clip pos="1" side="tl" part="anim"/><lit-tag v="nn"/></equal></and>
          </test>
          <let><clip pos="1" side="tl" part="anim"/><lit-tag v="an"/></let>
        </when>
      </choose>

      <out>
        <chunk name="adj" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SA"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="lemh"/>
            <clip pos="1" side="tl" part="tags"/>
            <clip pos="1" side="tl" part="lemq"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

  <rule comment="RULE: Adjective/Determiner + Noun, transfer noun's gender to adjective/determiner">
    <pattern>
      <pattern-item n="adj_det"/>
      <pattern-item n="nom"/>
    </pattern>
    <action>
      <call-macro n="case_adapter1"><with-param pos="1"/></call-macro>
      <call-macro n="case_adapter1"><with-param pos="2"/></call-macro>
      <call-macro n="case_adapter_n"><with-param pos="1"/><with-param pos="2"/></call-macro>
      <out>
        <chunk name="adj_det_n" case="caseFirstWord">
          <tags>
            <tag><lit-tag v="SN"/></tag>
          </tags>
          <lu>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
          <b/>
          <lu>
            <clip pos="2" side="tl" part="whole"/>
          </lu>
        </chunk>
      </out>
    </action>
  </rule>

<!--   <rule>
     <pattern>
       <pattern-item n="nom"/>
     </pattern>
     <action>
       <choose>
         <when>
           <test>
             <equal>
               <clip pos="1" side="sl" part="cas"/>
               <lit-tag v="prp"/>
             </equal>
           </test>
           <let>
             <clip pos="1" side="tl" part="cas"/>
             <lit-tag v="loc"/>
           </let>
         </when>
       </choose>
       <out>
         <chunk name="nom" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="SN"/></tag>
             <tag><clip pos="1" side="tl" part="gen"/></tag>
             <tag><clip pos="1" side="tl" part="anim"/></tag>
             <tag><clip pos="1" side="tl" part="nbr"/></tag>
	     <tag><clip pos="1" side="tl" part="cas"/></tag>
           </tags>
           <lu>
             <clip pos="1" side="tl" part="lem"/>
             <clip pos="1" side="tl" part="a_nom"/>
             <clip pos="1" side="tl" part="gen" link-to="2"/>
             <clip pos="1" side="tl" part="anim" link-to="3"/>
             <clip pos="1" side="tl" part="nbr" link-to="4"/>
	     <clip pos="1" side="tl" part="cas" link-to="5"/>
           </lu>
         </chunk>
       </out>
     </action>
  </rule> -->



</section-rules>

</transfer>
