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

<transfer default="chunk">

  <section-def-cats>
	<def-cat n="prn_personal"> 					<!--personal pronoun-->
	  <cat-item tags="prn.pers.*"/>
	</def-cat>
	<def-cat n="prn_possessive"> 					<!--possessive pronoun-->
	  <cat-item tags="prn.pos.*"/>
	</def-cat>
	<def-cat n="prn_demonstrative"> 					<!--demonstrative pronoun-->
	  <cat-item tags="prn.dem.*"/>
	</def-cat>
	<def-cat n="prn_quantitative"> 					<!--quantitative pronoun-->
	  <cat-item tags="prn.qnt.*"/>
	</def-cat>
	<def-cat n="prn_interrogative"> 					<!--interrogative pronoun-->
	  <cat-item tags="prn.itg.*"/>
	</def-cat>
	<def-cat n="prn_indefinite"> 					<!--indefinite pronoun-->
	  <cat-item tags="prn.ind.*"/>
	</def-cat>
	<def-cat n="prn_reflexive"> 					<!--reflexive pronoun-->
	  <cat-item tags="prn.ref.*"/>
	</def-cat>
    <def-cat n="nom">
      <cat-item tags="n.*"/>
      <cat-item tags="np.*"/>
    </def-cat>
    <def-cat n="nom_ind"> 					<!--noun, wiðout article-->
      <cat-item tags="n.*.ind"/>
      <cat-item tags="n.*.ind.*"/>
    </def-cat>
    <def-cat n="nom_def"> 					<!--noun, wið article-->
      <cat-item tags="n.*.def"/>
      <cat-item tags="n.*.def.*"/>
    </def-cat>
    <def-cat n="num">  						<!-- numeral    -->
      <cat-item tags="num.*"/>
    </def-cat>
    <def-cat n="inf"> 		     			<!--infinitive-->
      <cat-item tags="vblex.inf.*"/>
      <cat-item tags="vblex.inf"/>
      <cat-item tags="vbser.inf.*"/>
      <cat-item tags="vbser.inf"/>
      <cat-item tags="vbhaver.inf.*"/>
      <cat-item tags="vbhaver.inf"/>
      <cat-item tags="vbmod.inf.*"/>
      <cat-item tags="vbmod.inf"/>
      <cat-item tags="vaux.inf.*"/>
      <cat-item tags="vaux.inf"/>
    </def-cat>


<def-cat n="vbser_imp"> 					<!-- vera imperative-->
  <cat-item tags="vbser.imp"/>
</def-cat>

    <def-cat n="vimp"> 				    	<!--imperative-->
      <cat-item tags="vblex.imp.*"/>
      <cat-item tags="vblex.imp"/>
      <cat-item tags="vbhaver.imp.*"/>
      <cat-item tags="vbhaver.imp"/>
      <cat-item tags="vbmod.imp.*"/>
      <cat-item tags="vbmod.imp"/>
      <cat-item tags="vaux.imp.*"/>
      <cat-item tags="vaux.imp"/>
    </def-cat>
    <def-cat n="supn"> 				    	<!--supine-->
      <cat-item tags="vblex.supn.*"/>
      <cat-item tags="vblex.supn"/>
      <cat-item tags="vbser.supn.*"/>
      <cat-item tags="vbser.supn"/>
      <cat-item tags="vbhaver.supn.*"/>
      <cat-item tags="vbhaver.supn"/>
      <cat-item tags="vbmod.supn.*"/>
      <cat-item tags="vbmod.supn"/>
      <cat-item tags="vaux.supn.*"/>
      <cat-item tags="vaux.supn"/>
    </def-cat>
   <def-cat n="pprs"> 				    	<!--present participle-->
      <cat-item tags="vblex.*.pprs.*"/>
      <cat-item tags="vblex.pprs"/>
      <cat-item tags="vbser.*.pprs.*"/>
      <cat-item tags="vbser.*.pprs"/>
      <cat-item tags="vbhaver.pprs.*"/>
      <cat-item tags="vbhaver.pprs"/>
      <cat-item tags="vbmod.*.pprs.*"/>
      <cat-item tags="vbmod.*.pprs"/>
      <cat-item tags="vaux.*.pprs.*"/>
      <cat-item tags="vaux.*.pprs"/>
    </def-cat>
  <def-cat n="pp">                           <!--past participle -->
      <cat-item tags="vblex.pp.*"/>
      <cat-item tags="vblex.pp"/>
      <cat-item tags="vbser.pp.*"/>
      <cat-item tags="vbser.pp"/>
      <cat-item tags="vbhaver.pp.*"/>
      <cat-item tags="vbhaver.pp"/>
      <cat-item tags="vbmod.pp.*"/>
      <cat-item tags="vbmod.pp"/>
      <cat-item tags="vaux.pp.*"/>
      <cat-item tags="vaux.pp"/>
  </def-cat>

    <def-cat n="vfin"> 				    	<!--finite verb-->
      <cat-item tags="vblex.pres.*"/>
      <cat-item tags="vblex.past.*"/>
      <cat-item tags="vbser.pres.*"/>
      <cat-item tags="vbser.pres"/>
      <cat-item tags="vbser.past.*"/>
      <cat-item tags="vbser.past"/>
      <cat-item tags="vbhaver.pres"/>
      <cat-item tags="vbhaver.past"/>
      <cat-item tags="vbmod.pres.*"/>
      <cat-item tags="vbmod.past.*"/>
      <cat-item tags="vbmod.pres"/>
      <cat-item tags="vbmod.past"/>
      <cat-item tags="vaux.pres.*"/>
      <cat-item tags="vaux.past.*"/>
    </def-cat>

    <def-cat n="verb_passive"> 				<!--passive voice-->
      <cat-item tags="vblex.*.pasv"/>
      <cat-item tags="vblex.*.pasv.*"/>
      <cat-item tags="vbser.*.pasv"/>
      <cat-item tags="vbser.*.pasv.*"/>
      <cat-item tags="vbhaver.*.pasv"/>
      <cat-item tags="vbhaver.*.pasv.*"/>
      <cat-item tags="vbmod.*.pasv"/>
      <cat-item tags="vbmod.*.pasv.*"/>
      <cat-item tags="vaux.*.pasv"/>
      <cat-item tags="vaux.*.pasv.*"/>
    </def-cat>



   <def-cat n="prep">
      	<cat-item tags="pr"/>
    </def-cat>

    <def-cat n="prgen">                      <!--prepositions that govern the genitive case-->
      	<cat-item lemma="till" tags="pr"/>
		<cat-item lemma="inom" tags="pr"/> 
		<cat-item lemma="bland" tags="pr"/> 
		<cat-item lemma="mellan" tags="pr"/> 
		<cat-item lemma="utan" tags="pr"/> 
		<cat-item lemma="på grund av" tags="pr"/> 
    </def-cat>

    <def-cat n="prdat">                      <!--prepositions that govern the dative case-->
      	<cat-item lemma="åt" tags="pr"/>
		<cat-item lemma="av" tags="pr"/> 
		<cat-item lemma="från" tags="pr"/> 
		<cat-item lemma="emot" tags="pr"/> 
		<cat-item lemma="hos" tags="pr"/> 
		<cat-item lemma="ur" tags="pr"/> 
		<cat-item lemma="brevid" tags="pr"/> 
		<cat-item lemma="på" tags="pr"/>   <!--also acc-->
		<cat-item lemma="i" tags="pr"/>   <!--also acc-->
		<cat-item lemma="efter" tags="pr"/>   <!--also acc-->
		<cat-item lemma="med" tags="pr"/>   <!--also acc-->
    </def-cat>


    <def-cat n="pracc">                      <!--prepositions that govern the accusative case-->
      	<cat-item lemma="om" tags="pr"/>
		<cat-item lemma="genom" tags="pr"/> 
		<cat-item lemma="via" tags="pr"/> 
		<cat-item lemma="igenom" tags="pr"/> 
		<cat-item lemma="í kringum" tags="pr"/> 
		<cat-item lemma="fyrir utan" tags="pr"/> 
		<cat-item lemma="fyrir" tags="pr"/>    <!--also dat-->
    </def-cat>

    <def-cat n="vbgen">                      <!--verbs that govern the genitive case-->
      	<cat-item lemma="sakna" tags="vblex"/>
		<cat-item lemma="leta" tags="vblex"/> 
		<cat-item lemma="skällas ut" tags="vblex"/> 
    </def-cat>

    <def-cat n="vbdat">                      <!--verbs that govern the dative case-->
      	<cat-item lemma="hjälpa" tags="vblex"/>
		<cat-item lemma="lära" tags="vblex"/> 
		<cat-item lemma="sprida" tags="vblex"/> 
		<cat-item lemma="visa" tags="vblex"/> 
		<cat-item lemma="säga" tags="vblex"/> 
		<cat-item lemma="ge" tags="vblex"/> 
		<cat-item lemma="stänga" tags="vblex"/> 
		<cat-item lemma="lägga" tags="vblex"/> 
    </def-cat>


    <def-cat n="adj_ind"> 					<!--adjective indef, strong declension-->
      <cat-item tags="adj.*.ind"/>
    </def-cat>
    <def-cat n="adj_def"> 					<!--adjective def, weak declension-->
      <cat-item tags="adj.*.def"/>
    </def-cat>
    <def-cat n="adj_ord"> 					<!-- ord numeral-->
      <cat-item tags="adj.ord.*"/>
    </def-cat>
    <def-cat n="adj"> 				    	<!--adjective-->
      <cat-item tags="adj.*"/>
    </def-cat>
  <def-cat n="mer">
     <cat-item lemma="mer" tags="*"/>
  </def-cat>
  <def-cat n="mest">
     <cat-item lemma="mest" tags="*"/>
  </def-cat>

	<def-cat n="num234">  								<!-- numerals 23&4 -->
    <cat-item lemma="två" tags="num.*"/>
    <cat-item lemma="tre" tags="num.*"/>
    <cat-item lemma="fyra" tags="num.*"/>
	</def-cat>
  	<def-cat n="num1">  								<!-- numeral 1 -->
      <cat-item lemma="en" tags="num.*"/>
  	</def-cat>

	<def-cat n="prn_sig_ref"> 					<!--reflexive pronoun sig-->
    <cat-item lemma="sig" tags="prn.ref.*"/>
	</def-cat>

	<def-cat n="prn_possessive_vår"> 					<!--possessive pronouns vår er deras-->
	    <cat-item lemma="vår" tags="prn.pos.*"/>
	    <cat-item lemma="er" tags="prn.pos.*"/>
	    <cat-item lemma="deras" tags="prn.pos.*"/>
	</def-cat>
	<def-cat n="prn_possessive_minn"> 					<!--possessive pronouns min din sin-->
	    <cat-item lemma="min" tags="prn.pos.*"/>
	    <cat-item lemma="din" tags="prn.pos.*"/>
	    <cat-item lemma="sin" tags="prn.pos.*"/>
	</def-cat>
	<def-cat n="prn_interrogative_vilken"> 					<!--itg pronoun vilken-->
	    <cat-item lemma="vilken" tags="prn.itg.*"/>
	</def-cat>


<!--	<def-cat n="pr_gen"/>
  		<cat-item tags="pr"/>
	
	
	<cat-item lemma="till" tags="pr"/> 
	<cat-item lemma="inom" tags="pr"/> 
	<cat-item lemma="bland" tags="pr"/> 
	<cat-item lemma="mellan" tags="pr"/> 
	<cat-item lemma="utan" tags="pr"/> 
	<cat-item lemma="på grund av" tags="pr"/> 
	</def-cat> -->
  </section-def-cats>

  <section-def-attrs>
	<def-attr n="a_prn"> 							<!--PRONOUN-->
	  <attr-item tags="prn.pers"/>
	  <attr-item tags="prn.ref"/>
	  <attr-item tags="prn.pos"/>
	  <attr-item tags="prn.dem"/>
	  <attr-item tags="prn.ind"/>
	  <attr-item tags="prn.qnt"/>
	  <attr-item tags="prn.def"/>
	  <attr-item tags="prn.itg"/>
	  <attr-item tags="prn.rel"/>
	</def-attr>

    <def-attr n="a_nom">
      <attr-item tags="n"/>
      <attr-item tags="np"/>
      <attr-item tags="np.al"/>
      <attr-item tags="np.ant"/>
      <attr-item tags="np.top"/>
      <attr-item tags="np.org"/>
      <attr-item tags="np.cog"/>
    </def-attr>
    <def-attr n="a_adj"> 							<!--ADJECTIVE-->
      <attr-item tags="adj"/>
     <attr-item tags="adj.ord"/>
     <attr-item tags="adj.sint"/>
     <attr-item tags="adj.unsint"/> 
    </def-attr>
    <def-attr n="a_verb">
      <attr-item tags="vblex"/>
      <attr-item tags="vbmod"/>
      <attr-item tags="vaux"/>
      <attr-item tags="vbser"/>
      <attr-item tags="vbhaver"/>
    </def-attr>
    <def-attr n="a_num">
      <attr-item tags="num"/>
    </def-attr>
    <def-attr n="a_pr">   			<!--preposition    -->
      <attr-item tags="pr"/>
    </def-attr>
    <def-attr n="grau"> 							<!--COMPARISON-->
      <attr-item tags="pst"/>
      <attr-item tags="comp"/>
      <attr-item tags="sup"/>
    </def-attr>
    <def-attr n="grau_tags">
      <attr-item tags="sint"/>
      <attr-item tags="unsint"/>
    </def-attr>
    <def-attr n="gen">
      <attr-item tags="m"/>
      <attr-item tags="f"/>
      <attr-item tags="nt"/>
      <attr-item tags="ut"/>
      <attr-item tags="mf"/>
      <attr-item tags="mfn"/>
      <attr-item tags="GD"/>
    </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="subj"/>
      <attr-item tags="obj"/>
    </def-attr>
    <def-attr n="voz">
      <attr-item tags="actv"/>
      <attr-item tags="pasv"/>
      <attr-item tags="midv"/>
    </def-attr>
    <def-attr n="nbr">
      <attr-item tags="sg"/>
      <attr-item tags="pl"/>
      <attr-item tags="sp"/>
      <attr-item tags="ND"/>
    </def-attr>
    <def-attr n="pers">
      <attr-item tags="p1"/>
      <attr-item tags="p2"/>
      <attr-item tags="p3"/>
    </def-attr>
    <def-attr n="defnes">
      <attr-item tags="ind"/>
      <attr-item tags="def"/>
    </def-attr>
    <def-attr n="temps"> 							<!--TENSE-->
      <attr-item tags="inf"/>
      <attr-item tags="supn"/>
      <attr-item tags="imp"/>
      <attr-item tags="prs"/>
      <attr-item tags="pri"/>
      <attr-item tags="pres"/>
      <attr-item tags="past"/>
      <attr-item tags="pss"/>
      <attr-item tags="pp"/>
      <attr-item tags="pprs"/>
    </def-attr>
  </section-def-attrs>

  <section-def-vars>
    <def-var n="number"/>
    <def-var n="genere"/>
    <def-var n="cur_lema"/>
	<def-var n="caseFirstWord"/>
  	<def-var n="EOS" v="true"/>
  </section-def-vars>

<!--#######################################################################################-->
<!--###################				MACROS				###################################-->
<!--#######################################################################################-->
  <section-def-macros>
	
    <def-macro n="conv_case_to_acc" npar="1" > 	<!-- MACRO: convert nom to acc -->	
      <choose>
        <when>
          <test>
              <equal><clip pos="1" side="sl" part="cas"/><lit-tag v="nom"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="cas"/>
            <lit-tag v="acc"/>
          </let>
        </when>
      </choose>
    </def-macro>

    <def-macro n="conv_case_to_dat" npar="1" > 		<!-- MACRO: convert nom to dat-->	
      <choose>
        <when>
          <test>
              <equal><clip pos="1" side="sl" part="cas"/><lit-tag v="nom"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="cas"/>
            <lit-tag v="acc"/>
          </let>
        </when>
      </choose>
    </def-macro>

    <def-macro n="conv_case_to_gen" npar="1" > 		<!-- MACRO: convert nom to gen-->	
      <choose>
        <when>
          <test>
              <equal><clip pos="1" side="sl" part="cas"/><lit-tag v="nom"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="cas"/>
            <lit-tag v="gen"/>
          </let>
        </when>
      </choose>
    </def-macro>

	<def-macro n="conv_case_for_personal_pronouns" npar="1" > 						<!-- MACRO: subject/object -->	
	  <choose>
	    <when>
	      <test>
	          <equal><clip pos="1" side="sl" part="cas"/><lit-tag v="subj"/></equal>
	      </test>
	      <let>
	        <clip pos="1" side="tl" part="cas"/>
	        <lit-tag v="nom"/>
	      </let>
	    </when>
	    <when>
	      <test>
	          <equal><clip pos="1" side="sl" part="cas"/><lit-tag v="obj"/></equal>
	      </test>
	      <let>
	        <clip pos="1" side="tl" part="cas"/>
	        <lit-tag v="acc"/>
	      </let>
	    </when>
	  </choose>
	</def-macro>


    <def-macro n="conv_gender_temp" npar="1" > 	<!-- MACRO: used for adjectives (pst.pl, comp, sup: mfn) !!! -->	
      <choose>
        <when>
          <test>
				  <or>
	                <equal><clip pos="1" side="sl" part="gen"/><lit-tag v="ut"/></equal>
	                <equal><clip pos="1" side="sl" part="gen"/><lit-tag v="mfn"/></equal>
				  </or>
          </test>
          <let>
            <clip pos="1" side="tl" part="gen"/>
            <lit-tag v="m"/>
          </let>
        </when>
	 </choose>
    </def-macro>

							<!-- ut -> m -->	
    <def-macro n="conv_gender_for_numerals" npar="1" > 	
      <choose>
        <when>
          <test>
	                <equal><clip pos="1" side="sl" part="gen"/><lit-tag v="ut"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="gen"/>
            <lit-tag v="m"/>
          </let>
        </when>
	 </choose>
    </def-macro>    


    <def-macro n="conv_number2" npar="1" > 	<!-- MACRO: used for adjectives !!! -->	
      <choose>
        <when>
          <test>
	              <equal><clip pos="1" side="sl" part="nbr"/><lit-tag v="sp"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="nbr"/>
            <lit-tag v="sg"/>
          </let>
        </when>
	 </choose>
    </def-macro>

    <def-macro n="conv_number1" npar="1" > 	<!-- MACRO: rewrite!!! -->	
      <choose>
        <when>
          <test>
			<or>
			      <and>
	                  <equal><clip pos="1" side="sl" part="defnes"/><lit-tag v="def"/></equal>
      	              <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="pst"/></equal>
               	  </and>
                  <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="comp"/></equal>
                  <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="sup"/></equal>
    	    </or>
          </test>
          <let>
            <clip pos="1" side="tl" part="nbr"/>
            <lit-tag v="sg"/>
          </let>
        </when>
	 </choose>
    </def-macro>

    <def-macro n="set_defnes_ind" npar="1" > 	<!-- MACRO: for adj.comp with no tag for defnes, does it work? -->	
      <choose>
        <when>
          <test>
      	       <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="comp"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="defnes"/>
            <lit-tag v="ind"/>
          </let>
        </when>
	 </choose>
    </def-macro>

    <def-macro n="conv_gender_for_pp" npar="1" > 	<!-- MACRO: convert gender for past participles, 
																ut -> m
																mfn -> m
										this is a default setting, how is it possible to get an f, for example? -->	
      <choose>
        <when>
          <test>
            	<or>
              		<equal><clip pos="1" side="sl" part="gen"/><lit-tag v="ut"/></equal>
              		<equal><clip pos="1" side="sl" part="gen"/><lit-tag v="mfn"/></equal>
            	</or>
          </test>
          <let>
            <clip pos="1" side="tl" part="gen"/>
            <lit-tag v="m"/>
          </let>
        </when>
	 </choose>
    </def-macro>


    <def-macro n="conv_number_for_pp" npar="1" > 	<!-- MACRO: convert number for past participles, 
																sp -> sg           
																this is a default setting-->	
      <choose>
        <when>
          <test>
	              <equal><clip pos="1" side="sl" part="nbr"/><lit-tag v="sp"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="nbr"/>
            <lit-tag v="sg"/>
          </let>
        </when> 		
	 </choose>
    </def-macro>


    <!--    <def-macro n="conv_gender2" npar="1" > 			
      <choose>
        <when>
          <test>
	            <or>
	              <equal><clip pos="1" side="sl" part="nbr"/><lit-tag v="pl"/></equal>
	              <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="comp"/></equal>
	              <equal><clip pos="1" side="sl" part="grau"/><lit-tag v="sup"/></equal>
	            </or>
          </test>
          <let>
            <clip pos="1" side="tl" part="gen"/>
            <lit-tag v="ut"/>
          </let>
        </when>
 		</choose>
    </def-macro>  -->



    <def-macro n="conv_temps1" npar="1">	<!-- MACRO: convert present indicative to present indicative-->
      <choose>
        <when>
          <test>
              <equal><clip pos="1" side="sl" part="temps"/><lit-tag v="pres"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="temps"/>
            <lit-tag v="pri"/>
          </let>
        </when>
      </choose>
    </def-macro>

    <def-macro n="conv_voice_pas_to_mid" npar="1"> 		<!-- MACRO: convert passive voice to middle voice (-s)-->
      <choose>
        <when>
          <test>
              <equal><clip pos="1" side="sl" part="voz"/><lit-tag v="pasv"/></equal>
          </test>
          <let>
            <clip pos="1" side="tl" part="voz"/>
            <lit-tag v="midv"/>
          </let>
        </when>
      </choose>
    </def-macro>

    <def-macro n="firstWord" npar="1">
      <choose>
        <when>
          <test>
              <equal>
                <clip pos="1" side="sl" part="a_np"/>    <!--from is-en, removed the acr part -->
                <lit v=""/>
              </equal>
          </test>
          <choose>
            <when>
              <test>
                <equal> 
                  <var n="EOS"/>
                  <lit v="true"/>
                </equal> 
              </test>
              <modify-case>
                <clip pos="1" side="tl" part="lem"/>
                <lit v="aa"/>
              </modify-case>
              <let>
                <var n="caseFirstWord"/>
                <lit v="Aa"/>
              </let>
            </when>
            <otherwise> 
              <let>
                <var n="caseFirstWord"/>
                <lit v="aa"/>
              </let>
            </otherwise>
          </choose>
        </when>
        <otherwise>
          <let>
            <var n="caseFirstWord"/>
            <lit v="aa"/>
          </let>
        </otherwise>
      </choose>
      <let>
        <var n="EOS"/>
        <lit v="false"/>
      </let>
    </def-macro>



  </section-def-macros>

<!--#######################################################################################-->
<!--###################				RULES				###################################-->
<!--#######################################################################################-->




  <section-rules>

    <!-- Sintagmas nominales -->




	<rule comment="REGLA: MER ADJ  | mer hyfsad → þokkalegri">   <!-- --> 
		     <pattern>
		       <pattern-item n="mer"/>
		       <pattern-item n="adj"/>
		     </pattern>
		     <action>
		       <call-macro n="firstWord">
		         <with-param pos="2"/>
		       </call-macro>
		       <call-macro n="conv_gender_temp">
		         <with-param pos="2"/>
		       </call-macro>
		       <call-macro n="conv_number2">
		         <with-param pos="2"/>
		       </call-macro>
		       <out>
		         <chunk name="MER_ADJECTIVE" case="caseFirstWord">    
		           <tags>
		             <tag><lit-tag v="SA"/></tag>              
		              <tag><clip pos="2" side="tl" part="grau"/></tag>
		              <tag><clip pos="2" side="tl" part="gen"/></tag>
		              <tag><clip pos="2" side="tl" part="nbr"/></tag>
		              <tag><clip pos="2" side="tl" part="defnes"/></tag>
		            </tags>
		            <lu>
		              <clip pos="2" side="tl" part="lemh"/>
		              <clip pos="2" side="tl" part="a_adj"/>
		              <lit-tag v="comp"/>
		              <clip pos="2" side="tl" part="gen" link-to="3"/>
		              <clip pos="2" side="tl" part="nbr" link-to="4"/>
		              <lit-tag v="nom"/>
		              <clip pos="2" side="tl" part="defnes" link-to="5"/>
		              <clip pos="2" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		        </out>
		     </action>
	</rule>


<!--	<rule comment="REGLA: ADJ_SINT  | olämpligare → meira óviðeigandi">   
		     <pattern>
		       <pattern-item n="adj_sint"/>
		     </pattern>
		     <action>
		       <call-macro n="firstWord">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_gender_temp">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_number2">
		         <with-param pos="1"/>
		       </call-macro>
		       <out>
		         <chunk name="ADJ_SINT" case="caseFirstWord">    
		           <tags>
		             <tag><lit-tag v="SA"/></tag>              
		              <tag><lit-tag v="comp"/></tag>  
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><clip pos="1" side="tl" part="defnes"/></tag>
		            </tags>
		            <lu>
	                 <lit v="meira"/>
		            </lu>
		            <b pos="1"/>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_adj"/>
		              <lit-tag v="comp"/>
		              <clip pos="1" side="tl" part="gen" link-to="3"/>
		              <clip pos="1" side="tl" part="nbr" link-to="4"/>
		              <lit-tag v="nom"/>
		              <clip pos="1" side="tl" part="defnes" link-to="5"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		        </out>
		     </action>
	</rule>

--> 

	<rule comment="REGLA: ADJORD  | först → fyrstur">   <!-- ORDINAL NUMERALS --> 
		     <pattern>
		       <pattern-item n="adj_ord"/>
		     </pattern>
		     <action>
		       <call-macro n="firstWord">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_gender_temp">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_number2">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="set_defnes_ind">
		         <with-param pos="1"/>
		       </call-macro>
		       <out>
		         <chunk name="ADJECTIVE" case="caseFirstWord">    
		           <tags>
		             <tag><lit-tag v="SA"/></tag>              
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><lit-tag v="nom"/></tag>
		              <tag><clip pos="1" side="tl" part="defnes"/></tag>
		            </tags>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <lit-tag v="adj"/>  
		              <lit-tag v="ord"/>  
		              <clip pos="1" side="tl" part="gen" link-to="2"/>
		              <clip pos="1" side="tl" part="nbr" link-to="3"/>
		              <lit-tag v="nom"/>
		              <lit-tag v="ind"/>
<!--		              <clip pos="1" side="tl" part="defnes" link-to="6"/>  PROBA!-->
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		         </out>
		 </action>
	</rule>

	<rule comment="REGLA: ADJ  | vacker → fallegur">   <!-- --> 
		     <pattern>
		       <pattern-item n="adj"/>
		     </pattern>
		     <action>
		       <call-macro n="firstWord">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_gender_temp">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="conv_number2">
		         <with-param pos="1"/>
		       </call-macro>
		       <call-macro n="set_defnes_ind">
		         <with-param pos="1"/>
		       </call-macro>
		    <choose>
	         <when>
	           <test>
				<and>
	             <equal>
	               <clip pos="1" side="tl" part="a_adj"/>
	               <lit-tag v="adj.unsint"/>
	             </equal>
	             <equal>
	               <clip pos="1" side="sl" part="grau"/>
	               <lit-tag v="comp"/>
	             </equal>
				</and>
	           </test>
		       <out>
		         <chunk name="ADJ_COMP_UNSINT" case="caseFirstWord">    <!--olämpligare - meira óviðeigandi --> 
		           <tags>
		             <tag><lit-tag v="SA"/></tag>     
		              <tag><clip pos="1" side="tl" part="grau"/></tag>
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><lit-tag v="nom"/></tag>
		              <tag><lit-tag v="ind"/></tag>
		            </tags>
		            <lu>
		              <lit v="meira"/>
		              <lit-tag v="adv"/>
		            </lu>
		            <b pos="0"/>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <lit-tag v="adj"/>
		              <lit-tag v="pst"/>
		              <clip pos="1" side="tl" part="gen" link-to="3"/>
		              <clip pos="1" side="tl" part="nbr" link-to="4"/>
		              <lit-tag v="nom"/>
		              <lit-tag v="ind"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		         </out>
	         </when>
	         <when>
	           <test>
				<and>
	             <equal>
	               <clip pos="1" side="tl" part="a_adj"/>
	               <lit-tag v="adj.unsint"/>
	             </equal>
	             <equal>
	               <clip pos="1" side="sl" part="grau"/>
	               <lit-tag v="sup"/>
	             </equal>
				</and>
	           </test>
		       <out>
		         <chunk name="ADJ_SUP_UNSINT" case="caseFirstWord">   <!--olämpligast - mest óviðeigandi --> 
		           <tags>
		             <tag><lit-tag v="SA"/></tag>     
		              <tag><clip pos="1" side="tl" part="grau"/></tag>
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><lit-tag v="nom"/></tag>
		              <tag><clip pos="1" side="tl" part="defnes"/></tag>
		            </tags>
		            <lu>
		              <lit v="mest"/>
		              <lit-tag v="adv"/>
		            </lu>
		            <b pos="0"/>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <lit-tag v="adj"/>
		              <lit-tag v="pst"/>
		              <clip pos="1" side="tl" part="gen" link-to="3"/>
		              <clip pos="1" side="tl" part="nbr" link-to="4"/>
		              <lit-tag v="nom"/>
		              <clip pos="1" side="tl" part="nbr" link-to="6"/>   <!--
NB!!!								ha?????? NB!!!!!
		              -->
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		         </out>
	         </when>
			<otherwise>
		       <out>
		         <chunk name="ADJECTIVE" case="caseFirstWord">    
		           <tags>
		             <tag><lit-tag v="SA"/></tag>              
		              <tag><clip pos="1" side="tl" part="grau"/></tag>
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><lit-tag v="nom"/></tag>
		              <tag><clip pos="1" side="tl" part="defnes"/></tag>
		            </tags>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <lit-tag v="adj"/>  <!--to avoid sint/unsint            -->
		              <clip pos="1" side="tl" part="grau" link-to="2"/>
		              <clip pos="1" side="tl" part="gen" link-to="3"/>
		              <clip pos="1" side="tl" part="nbr" link-to="4"/>
		              <lit-tag v="nom"/>
		              <lit-tag v="ind"/>   		<!-- is this correct??? -->
<!--		              <clip pos="1" side="tl" part="defnes" link-to="6"/>  PROBA!-->
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		         </out>
			</otherwise>
			</choose>
		 </action>
	</rule>



	<!--This rule is for the number 1 that decline in Icelandic but have only two forms in Swedish. I haven't thought of a more sophisticate way than to just put them by default into ut nom for m/f and nt nom for nt. Or does acc make more sense statistically? -->
		    <rule comment="regla: num1">
		      <pattern>
		        <pattern-item n="num1"/>
		      </pattern>
		      <action>
				       <call-macro n="firstWord">
				         <with-param pos="1"/>
				       </call-macro>
				       <call-macro n="conv_gender_for_numerals">
				         <with-param pos="1"/>
				       </call-macro>
	        	<out>
		          <chunk name="NUMBER1" case="caseFirstWord">
		            <tags>
		              <tag><lit-tag v="NUM"/></tag>
		              <tag><clip pos="1" side="tl" part="gen"/></tag>
		              <tag><clip pos="1" side="tl" part="nbr"/></tag>
		              <tag><lit-tag v="nom"/></tag>
		            </tags>
		            <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_num"/>
		              <clip pos="1" side="tl" part="gen" link-to="2"/>
		              <clip pos="1" side="tl" part="nbr" link-to="3"/>
		              <lit-tag v="4"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		        </out>
		      </action>
		    </rule>


<!--This rule is for the numbers 23&4 that decline in Icelandic but have only one form in Swedish. I haven't thought of a more sophisticate way than to just put them by default into m nom. Or does acc make more sense statistically? -->
	    <rule comment="regla: num234">
	      <pattern>
	        <pattern-item n="num234"/>
	      </pattern>
	      <action>
			       <call-macro n="firstWord">
			         <with-param pos="1"/>
			       </call-macro>
        	<out>
	          <chunk name="NUMBER234" case="caseFirstWord">
	            <tags>
	              <tag><lit-tag v="NUM"/></tag>
	              <tag><lit-tag v="m"/></tag>
	              <tag><lit-tag v="pl"/></tag>
	              <tag><lit-tag v="nom"/></tag>
	            </tags>
	            <lu>
	              <clip pos="1" side="tl" part="lemh"/>
	              <clip pos="1" side="tl" part="a_num"/>
	              <clip pos="1" side="tl" part="gen" link-to="2"/>
	              <clip pos="1" side="tl" part="nbr" link-to="3"/>
	              <lit-tag v="4"/>
	              <clip pos="1" side="tl" part="lemq"/>
	            </lu>
	          </chunk>
	        </out>
	      </action>
	    </rule>



    <rule comment="regla: num">
      <pattern>
        <pattern-item n="num"/>
      </pattern>
      <action>
		       <call-macro n="firstWord">
		         <with-param pos="1"/>
		       </call-macro>
        <out>
          <chunk name="NUMBER" case="caseFirstWord">
            <tags>
              <tag><lit-tag v="NUM"/></tag>
              <tag><clip pos="1" side="tl" part="gen"/></tag>
              <tag><clip pos="1" side="tl" part="nbr"/></tag>
              <tag><lit-tag v="nom"/></tag>
              <tag><clip pos="1" side="tl" part="defnes"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="lemh"/>
              <clip pos="1" side="tl" part="a_num"/>
              <clip pos="1" side="tl" part="gen" link-to="2"/>
              <clip pos="1" side="tl" part="nbr" link-to="3"/>
              <lit-tag v="4"/>
              <clip pos="1" side="tl" part="defnes" link-to="5"/>
              <clip pos="1" side="tl" part="lemq"/>
            </lu>
          </chunk>
        </out>
      </action>
    </rule>



    <rule comment="regla: nom">
      <pattern>
        <pattern-item n="nom"/>
      </pattern>
      <action>
        <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="nbr"/></tag>
              <tag><clip pos="1" side="tl" part="cas"/></tag>
              <tag><clip pos="1" side="tl" part="defnes"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="lemh"/>
              <clip pos="1" side="tl" part="a_nom"/>
              <clip pos="1" side="tl" part="gen" link-to="2"/>
              <clip pos="1" side="tl" part="nbr" link-to="3"/>
              <clip pos="1" side="tl" part="cas" link-to="4"/>
              <clip pos="1" side="tl" part="defnes" link-to="5"/>
              <clip pos="1" side="tl" part="lemq"/>
            </lu>
          </chunk>
        </out>
      </action>
    </rule>

<!--  <rule comment="REGLA: PREP → PREP | till -> til">
     <pattern>
       <pattern-item n="prep"/>
     </pattern>
     <action>
       <call-macro n="firstWord">
         <with-param pos="1"/>
       </call-macro>
       <out>
         <chunk namefrom="PREP" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="PREP"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="whole"/>
            </lu>
          </chunk>
        </out>
     </action>
  </rule>
-->

  <rule comment="REGLA: PREP_GEN → PREP_GEN | till -> til">  <!--prep that governs gen-->
     <pattern>
       <pattern-item n="prgen"/>
     </pattern>
     <action>
       <call-macro n="firstWord">
         <with-param pos="1"/>
       </call-macro>
       <out>
         <chunk name="prep_gov_gen" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="PREPGEN"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="whole"/>
            </lu>
          </chunk>
        </out>
     </action>
  </rule>

  <rule comment="REGLA: PREP_DAT → PREP_DAT | hjá -> hos">  <!--prep that governs dat-->
     <pattern>
       <pattern-item n="prdat"/>
     </pattern>
     <action>
       <call-macro n="firstWord">
         <with-param pos="1"/>
       </call-macro>
       <out>
         <chunk name="prep_gov_dat" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="PREPDAT"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="whole"/>
            </lu>
          </chunk>
        </out>
     </action>
  </rule>

  <rule comment="REGLA: PREP_ACC → PREP_ACC | om -> um">  <!--prep that governs acc-->
     <pattern>
       <pattern-item n="pracc"/>
     </pattern>
     <action>
       <call-macro n="firstWord">
         <with-param pos="1"/>
       </call-macro>
       <out>
         <chunk name="prep_gov_acc" case="caseFirstWord">
           <tags>
             <tag><lit-tag v="PREPACC"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="whole"/>
            </lu>
          </chunk>
        </out>
     </action>
  </rule>


    <rule comment="regla: adj nom (undef) | vackert öl → fallegur bjór">  <!-- works -->
	      <pattern>
	        <pattern-item n="adj_ind"/>
	        <pattern-item n="nom_ind"/>
	      </pattern>
	      <action>
	        <out>
	          <chunk name="adj_nom_undef" case="caseFirstWord">
	            <tags>
	              <tag><lit-tag v="SN"/></tag>
	              <tag><clip pos="2" side="tl" part="gen"/></tag>
	              <tag><clip pos="2" side="tl" part="nbr"/></tag>
	              <tag><clip pos="2" side="tl" part="cas"/></tag>
	              <tag><clip pos="2" side="tl" part="defnes"/></tag>
	            </tags>
	            <lu>
	              <clip pos="1" side="tl" part="lemh"/>
	              <clip pos="1" side="tl" part="a_adj"/>
	              <clip pos="1" side="tl" part="grau"/>
	              <clip pos="2" side="tl" part="gen" link-to="2"/>   
	              <clip pos="2" side="tl" part="nbr" link-to="3"/>
	              <clip pos="2" side="tl" part="cas" link-to="4"/>     
	              <clip pos="2" side="tl" part="defnes" link-to="5"/>     
	              <clip pos="1" side="tl" part="lemq"/>
	            </lu>
	            <b pos="1"/>
	            <lu>
	              <clip pos="2" side="tl" part="lemh"/>
	              <clip pos="2" side="tl" part="a_nom"/>
	              <clip pos="2" side="tl" part="gen" link-to="2"/>
	              <clip pos="2" side="tl" part="nbr" link-to="3"/>
	              <clip pos="2" side="tl" part="cas" link-to="4"/>
	              <clip pos="2" side="tl" part="defnes" link-to="5"/>
	              <clip pos="2" side="tl" part="lemq"/>
	            </lu>
	          </chunk>
	        </out>
	      </action>
	</rule>


    <rule comment="regla: adj nom (def) | vackra ölet → fallegi bjórinn">  <!-- works -->
	      <pattern>
	        <pattern-item n="adj_def"/>
	        <pattern-item n="nom_def"/>
	      </pattern>
	      <action>
	        <out>
	          <chunk name="adj_nom_def" case="caseFirstWord">
	            <tags>
	              <tag><lit-tag v="SN"/></tag>
	              <tag><clip pos="2" side="tl" part="gen"/></tag>
	              <tag><clip pos="2" side="tl" part="nbr"/></tag>
	              <tag><clip pos="2" side="tl" part="cas"/></tag>
	              <tag><clip pos="2" side="tl" part="defnes"/></tag>
	            </tags>
	            <lu>
	              <clip pos="1" side="tl" part="lemh"/>
	              <clip pos="1" side="tl" part="a_adj"/>
	              <clip pos="1" side="tl" part="grau"/>
	              <clip pos="2" side="tl" part="gen" link-to="2"/>   
	              <clip pos="2" side="tl" part="nbr" link-to="3"/>
	              <clip pos="2" side="tl" part="cas" link-to="4"/>     
	              <clip pos="2" side="tl" part="defnes" link-to="5"/>     
	              <clip pos="1" side="tl" part="lemq"/>
	            </lu>
	            <b pos="1"/>
	            <lu>
	              <clip pos="2" side="tl" part="lemh"/>
	              <clip pos="2" side="tl" part="a_nom"/>
	              <clip pos="2" side="tl" part="gen" link-to="2"/>
	              <clip pos="2" side="tl" part="nbr" link-to="3"/>
	              <clip pos="2" side="tl" part="cas" link-to="4"/>
	              <clip pos="2" side="tl" part="defnes" link-to="5"/>
	              <clip pos="2" side="tl" part="lemq"/>
	            </lu>
	          </chunk>
	        </out>
	      </action>
	</rule>


<!--
		>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>	V E R B S <<<<<<<<<<<<<<<<<<<<<<<
-->


<rule comment="REGLA: VBSER_IMP">  
														<!-- vera imperative		-->
	     <pattern>
	       <pattern-item n="vbser_imp"/>
	     </pattern>
	     <action>
	       <call-macro n="firstWord">                           
	         <with-param pos="1"/>
	       </call-macro>    
		       <out>
		         <chunk name="VBSER_IMP" case="caseFirstWord">   
		           <tags>
		             <tag><lit-tag v="VBSER_IMP"/></tag>     
	              	 <tag><clip pos="1" side="tl" part="temps"/></tag>
	              	 <tag><clip pos="1" side="tl" part="pers"/></tag>
	              	 <tag><clip pos="1" side="tl" part="nbr"/></tag>
		           </tags>
		           <lu>     <!-- I choose the most common form in Icelandic p2.sg        -->
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_verb"/>
		              <clip pos="1" side="tl" part="temps"/>
					  <lit-tag v="p2"/>
					  <lit-tag v="sg"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		       </out>
	     </action>
</rule>



<rule comment="REGLA: VERB_IMP">  
														<!-- imperative		-->
	     <pattern>
	       <pattern-item n="vimp"/>
	     </pattern>
	     <action>
	       <call-macro n="firstWord">                           
	         <with-param pos="1"/>
	       </call-macro>    
		       <out>
		         <chunk name="VERB_IMP" case="caseFirstWord">   
		           <tags>
		             <tag><lit-tag v="V_IMP"/></tag>     
	              	 <tag><clip pos="1" side="tl" part="voz"/></tag>
	              	 <tag><clip pos="1" side="tl" part="temps"/></tag>
	              	 <tag><clip pos="1" side="tl" part="pers"/></tag>
	              	 <tag><clip pos="1" side="tl" part="nbr"/></tag>
		           </tags>
		           <lu>     <!-- I choose the most common form in Icelandic p2.sg        -->
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_verb"/>
					  <lit-tag v="actv"/>
		              <clip pos="1" side="tl" part="temps"/>
					  <lit-tag v="p2"/>
					  <lit-tag v="sg"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		       </out>
	     </action>
</rule>

    <rule comment="regla: VERB_PP">
      <pattern>
        <pattern-item n="pp"/>
      </pattern>
      <action>
	      <call-macro n="conv_gender_for_pp"> 
	        <with-param pos="1"/>
	      </call-macro>
	      <call-macro n="conv_number_for_pp"> 
	        <with-param pos="1"/>
	      </call-macro>
        <out>
          <chunk name="VERB_PP" case="caseFirstWord">
            <tags>
              	 <tag><lit-tag v="VERB_PP"/></tag>   		<!--this section might need revision        -->
             	 <tag><clip pos="1" side="tl" part="voz"/></tag>
             	 <tag><clip pos="1" side="tl" part="temps"/></tag>
	             <tag><clip pos="1" side="tl" part="gen"/></tag>
	             <tag><clip pos="1" side="tl" part="nbr"/></tag>
	             <tag><clip pos="1" side="tl" part="cas"/></tag>
	             <tag><clip pos="1" side="tl" part="defnes"/></tag>
            </tags>
            <lu>
              <clip pos="1" side="tl" part="lemh"/>
              <clip pos="1" side="tl" part="a_verb"/>
			  <lit-tag v="actv"/>
              <clip pos="1" side="tl" part="temps"/>
              <clip pos="1" side="tl" part="gen"/>
              <clip pos="1" side="tl" part="nbr"/>
			  <lit-tag v="acc"/>
              <clip pos="1" side="tl" part="defnes"/>
              <clip pos="1" side="tl" part="lemq"/>
            </lu>
          </chunk>
        </out>
      </action>
    </rule>


	<rule comment="REGLA: VERB_PPRS">  
		     <pattern>
		       <pattern-item n="pprs"/>
		     </pattern>
		     <action>
		       <call-macro n="firstWord">                           
		         <with-param pos="1"/>
		       </call-macro>    
			       <out>
			         <chunk name="VERB_PPRS" case="caseFirstWord">   
			           <tags>
			             <tag><lit-tag v="V_PPRS"/></tag>     
		              	 <tag><clip pos="1" side="tl" part="temps"/></tag>
			           </tags>
			           <lu>
			              <clip pos="1" side="tl" part="lemh"/>
			              <clip pos="1" side="tl" part="a_verb"/>
			              <clip pos="1" side="tl" part="temps"/>
			              <clip pos="1" side="tl" part="lemq"/>
			            </lu>
			          </chunk>
			       </out>
		     </action>
	</rule>

									

<!--
	SWEDISH PASSIVE VOICE  =======> VERÐUR PP.M.SG       levereras ===> verður afhentur
	does not work for verbs governing dat and gen where the "subject" is in the oblique case and the verb is in pp.nt.sg
-->

<rule comment="regla: V_PASS">
  <pattern>
    <pattern-item n="verb_passive"/>
  </pattern>
  <action>
      <call-macro n="firstWord">                           
        <with-param pos="1"/>
      </call-macro>    
      <choose>
	        <when>
	           <test>
	             <equal>
	               <clip pos="1" side="sl" part="temps"/>
	               <lit-tag v="inf"/>
	             </equal>
	           </test>
		     				<out>
						         <chunk name="VERB_PASSIVE_INFINITIVE" case="caseFirstWord">    <!--VERB_INF-->
						           <tags>
						             <tag><lit-tag v="VERB_PASS_INF"/></tag>     <!--V_INF-->
						              <tag><lit-tag v="vblex"/></tag>   
						              <tag><lit-tag v="actv"/></tag>   
						              <tag><lit-tag v="inf"/></tag>   
						            </tags>
						            <lu>
						              <lit v="verða"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
						              <lit-tag v="inf"/>
						            </lu>
						            <b pos="0"/>
						            <lu>
						              <clip pos="1" side="tl" part="lemh"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
									  <lit-tag v="pp"/>
				    				  <lit-tag v="m"/>
				    				  <lit-tag v="sg"/>
				    				  <lit-tag v="nom"/>
						              <lit-tag v="ind"/>        
						              <clip pos="1" side="tl" part="lemq"/>
						            </lu>
						          </chunk>
	 						</out>
        	</when>

	        <when>
	           <test>
	             <equal>
	               <clip pos="1" side="sl" part="temps"/>
	               <lit-tag v="supn"/>
	             </equal>
	           </test>
		     				<out>
						         <chunk name="VERB_PASSIVE_SUPINUM" case="caseFirstWord">    
						           <tags>
						             <tag><lit-tag v="VERB_PASS_SUPN"/></tag>     
						              <tag><lit-tag v="vblex"/></tag>   
						              <tag><lit-tag v="actv"/></tag>   
						              <tag><lit-tag v="supn"/></tag>   
						            </tags>
						            <lu>
						              <lit v="verða"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
						              <lit-tag v="supn"/>
						            </lu>
						            <b pos="0"/>
						            <lu>
						              <clip pos="1" side="tl" part="lemh"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
									  <lit-tag v="pp"/>
				    				  <lit-tag v="m"/>
				    				  <lit-tag v="sg"/>
				    				  <lit-tag v="nom"/>
						              <lit-tag v="ind"/>        
						              <clip pos="1" side="tl" part="lemq"/>
						            </lu>
						          </chunk>
	 						</out>
        	</when>

	        <when>
	           <test>
	             <equal>
	               <clip pos="1" side="sl" part="temps"/>
	               <lit-tag v="pres"/>
	             </equal>
	           </test>
		     				<out>
						         <chunk name="VERB_PASSIVE_PRESENT" case="caseFirstWord">    
						           <tags>
						             <tag><lit-tag v="VERB_PASS_PRES"/></tag>     <!-- 3p sg by default-->
						              <tag><lit-tag v="vblex"/></tag>   
						              <tag><lit-tag v="actv"/></tag>   
						              <tag><lit-tag v="pri"/></tag>   
						              <tag><lit-tag v="p3"/></tag>   
						              <tag><lit-tag v="sg"/></tag>   
						            </tags>
						            <lu>
						              <lit v="verða"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
						              <lit-tag v="pri"/>
						              <lit-tag v="p3"/>
						              <lit-tag v="sg"/>
						            </lu>
						            <b pos="0"/>
						            <lu>
						              <clip pos="1" side="tl" part="lemh"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
									  <lit-tag v="pp"/>
				    				  <lit-tag v="m"/>
				    				  <lit-tag v="sg"/>
				    				  <lit-tag v="nom"/>
						              <lit-tag v="ind"/>        
						              <clip pos="1" side="tl" part="lemq"/>
						            </lu>
						          </chunk>
	 						</out>
        	</when>

	        <when>
	           <test>
	             <equal>
	               <clip pos="1" side="sl" part="temps"/>
	               <lit-tag v="past"/>
	             </equal>
	           </test>
		     				<out>
						         <chunk name="VERB_PASSIVE_PAST" case="caseFirstWord">    
						           <tags>
						             <tag><lit-tag v="VERB_PASS_PAST"/></tag>     <!-- 3p sg by default-->
						              <tag><lit-tag v="vblex"/></tag>   
						              <tag><lit-tag v="actv"/></tag>   
						              <tag><lit-tag v="past"/></tag>   
						              <tag><lit-tag v="p3"/></tag>   
						              <tag><lit-tag v="sg"/></tag>   
						            </tags>
						            <lu>
						              <lit v="verða"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
						              <lit-tag v="past"/>
						              <lit-tag v="p3"/>
						              <lit-tag v="sg"/>
						            </lu>
						            <b pos="0"/>
						            <lu>
						              <clip pos="1" side="tl" part="lemh"/>
						              <lit-tag v="vblex"/>
						              <lit-tag v="actv"/>
									  <lit-tag v="pp"/>
				    				  <lit-tag v="m"/>
				    				  <lit-tag v="sg"/>
				    				  <lit-tag v="nom"/>
						              <lit-tag v="ind"/>        
						              <clip pos="1" side="tl" part="lemq"/>
						            </lu>
						          </chunk>
	 						</out>
        	</when>

	  </choose>
  </action>
</rule>



<!--
    <rule comment="regla: till nom(gen) | till staden → til borgarinnar">   moved to t2x 
	      <pattern>
	        <pattern-item n="prgen"/>
	        <pattern-item n="nom"/>
	      </pattern>
	      <action>
	        <call-macro n="conv_case_to_gen">   	
	          <with-param pos="2"/>
	        </call-macro>
	        <out>
	          <chunk name="TILL_STADEN" case="caseFirstWord">
	            <tags>
	              <tag><lit-tag v="SPrep"/></tag>
	            </tags>
	            <lu>
	              <clip pos="1" side="tl" part="lemh"/>
	              <clip pos="1" side="tl" part="a_pr"/>
	              <clip pos="1" side="tl" part="lemq"/>
	            </lu>
	            <b pos="1"/>
	            <lu>
	              <clip pos="2" side="tl" part="lemh"/>
	              <clip pos="2" side="tl" part="a_nom"/>
	              <clip pos="2" side="tl" part="gen"/>
	              <clip pos="2" side="tl" part="nbr"/>
	              <lit-tag v="gen"/>
	              <clip pos="2" side="tl" part="defnes"/>
	              <clip pos="2" side="tl" part="lemq"/>
	            </lu>
	          </chunk>
	        </out>
	      </action>
	</rule> 
-->


<rule comment="REGLA: VERB_INF ">  
	     <pattern>
	       <pattern-item n="inf"/>
	     </pattern>
	     <action>
	       <call-macro n="firstWord">                           
	         <with-param pos="1"/>
	       </call-macro>    
	       <call-macro n="conv_voice_pas_to_mid">                           
	         <with-param pos="1"/>
	       </call-macro>    
							<!--INFINITVES 	needed to change the order of tags (actv.inf in Icelandic to inf.actv in Swedish)-->

		       <out>
		         <chunk name="VERB_INF" case="caseFirstWord">   
		           <tags>
		             <tag><lit-tag v="V_INF"/></tag>     
		             <tag><clip pos="1" side="tl" part="voz"/></tag>
	              	 <tag><clip pos="1" side="tl" part="temps"/></tag>
		           </tags>
		           <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_verb"/>
		              <clip pos="1" side="tl" part="voz"/>
		              <clip pos="1" side="tl" part="temps"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		       </out>
	     </action>
</rule>

<rule comment="REGLA: VERB_SUPN">  
	     <pattern>
	       <pattern-item n="supn"/>
	     </pattern>
	     <action>
	       <call-macro n="firstWord">                           
	         <with-param pos="1"/>
	       </call-macro>    
	       <call-macro n="conv_voice_pas_to_mid">                           
	         <with-param pos="1"/>
	       </call-macro>    
							<!--supines skrifað -> 	needed to change the order of tags-->

		       <out>
		         <chunk name="VERB_SUPN" case="caseFirstWord">   
		           <tags>
		             <tag><lit-tag v="V_SUPN"/></tag>     
		             <tag><clip pos="1" side="tl" part="voz"/></tag>
	              	 <tag><clip pos="1" side="tl" part="temps"/></tag>
		           </tags>
		           <lu>
		              <clip pos="1" side="tl" part="lemh"/>
		              <clip pos="1" side="tl" part="a_verb"/>
		              <clip pos="1" side="tl" part="voz"/>
		              <clip pos="1" side="tl" part="temps"/>
		              <clip pos="1" side="tl" part="lemq"/>
		            </lu>
		          </chunk>
		       </out>
	     </action>
</rule>


							<!--						FINITE VERB 	-->
<rule comment="regla: VFIN">
  <pattern>
    <pattern-item n="vfin"/>
  </pattern>
  <action>
    <call-macro n="conv_temps1">
      <with-param pos="1"/>
    </call-macro>
    <call-macro n="conv_voice_pas_to_mid">                           
         <with-param pos="1"/>
    </call-macro>    
    <out>
      <chunk name="VFIN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="IS.FIN"/></tag>
          <tag><clip pos="1" side="tl" part="voz"/></tag>
          <tag><clip pos="1" side="tl" part="temps"/></tag>
          <tag><clip pos="1" side="tl" part="pers"/></tag>
          <tag><clip pos="1" side="tl" part="nbr"/></tag>
        </tags>
        <lu>
          <clip pos="1" side="tl" part="lemh"/>
          <clip pos="1" side="tl" part="a_verb"/>
          <clip pos="1" side="tl" part="voz" link-to="3"/>
          <clip pos="1" side="tl" part="temps"/>
		  <lit-tag v="p3"/>
		  <lit-tag v="sg"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>

<rule comment="regla: prn_pers">
  <pattern>
    <pattern-item n="prn_personal"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_case_for_personal_pronouns">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_numerals">
	         <with-param pos="1"/>
	       </call-macro>

    <out>
      <chunk name="PERS_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_PERS"/></tag>
          <tag><clip pos="1" side="tl" part="pers"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <clip pos="1" side="tl" part="pers"/>
          <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="regla: prn_indefinite">
  <pattern>
    <pattern-item n="prn_indefinite"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="INDEFINITE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_INDEFINITE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <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="regla: prn_possessive_vår">
  <pattern>
    <pattern-item n="prn_possessive_vår"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="POSSESIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_POSSESSIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></tag>
          <tag><clip pos="1" side="tl" part="nbr"/></tag>
        </tags>
        <lu>
          <clip pos="1" side="tl" part="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <lit-tag v="mfn"/>
          <lit-tag v="sp"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>


<!--A rule for the possessive pronouns min, din, sin. Nom is chosen as the default case (maybe acc is better?). M is chosen as the default gender 
-->
<rule comment="regla: prn_possessive_minn">
  <pattern>
    <pattern-item n="prn_possessive_minn"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="POSSESSIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_POSSESSIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <clip pos="1" side="tl" part="gen"/>
          <clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="nom"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>

<!--A rule for demonostrative pronouns. Ut/mfn -> m, nom by default. Same as the above for min, din etc eiginlega-->
<rule comment="regla: prn_demonstrative">
  <pattern>
    <pattern-item n="prn_demonstrative"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="DEMONSTRATIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_DEMONSTRATIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <clip pos="1" side="tl" part="gen"/>
          <clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="nom"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>


<!--A rule for quantitative pronouns. Ut/mfn -> m. Same as the above for min, din etc eiginlega + defnes-->
<rule comment="regla: prn_quantitative">
  <pattern>
    <pattern-item n="prn_quantitative"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="QUANTITATIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_QUANTITATIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></tag>
          <tag><clip pos="1" side="tl" part="nbr"/></tag>
          <tag><clip pos="1" side="tl" part="cas"/></tag>
          <tag><clip pos="1" side="tl" part="defnes"/></tag>
        </tags>
        <lu>
          <clip pos="1" side="tl" part="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <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="defnes"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>


<!-- a rule that transfers vilken to hvaða. One of the few cases where an Icelandic word is less morphologically complex than the Swedish one. .-->
<rule comment="regla: prn_interrogative_vilken">
  <pattern>
    <pattern-item n="prn_interrogative_vilken"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="INTERROGATIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_INTERROGATIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></tag>
          <tag><clip pos="1" side="tl" part="nbr"/></tag>
        </tags>
        <lu>
          <clip pos="1" side="tl" part="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <lit-tag v="mfn"/>
          <lit-tag v="sp"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>



<!--A rule for interrogative pronouns. Ut/mfn -> m, . Same as the above for min, din etc eiginlega -->
<rule comment="regla: prn_interrogative">
  <pattern>
    <pattern-item n="prn_interrogative"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="INTERROGATIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_INTERROGATIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <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 for the relf prn sig, which has only one form in Swedish but three forms for the oblique cases in Icelandic. I have chosen the most common, acc form for transfer-->
<rule comment="regla: prn_sig_ref">
  <pattern>
    <pattern-item n="prn_sig_ref"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="PRN_REF" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_REF"/></tag>
          <tag><clip pos="1" side="tl" part="pers"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <clip pos="1" side="tl" part="pers"/>
          <clip pos="1" side="tl" part="gen"/>
          <clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="acc"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>

<!--Rule for the refl prn, I chose acc as the default case-->
<rule comment="regla: prn_reflexive">
  <pattern>
    <pattern-item n="prn_reflexive"/>
  </pattern>
  <action>
	       <call-macro n="firstWord">
	         <with-param pos="1"/>
	       </call-macro>
	       <call-macro n="conv_gender_for_pp">
	         <with-param pos="1"/>
	       </call-macro>
    <out>
      <chunk name="REFLEXIVE_PRN" case="caseFirstWord">
        <tags>
          <tag><lit-tag v="PRN_REFLEXIVE"/></tag>
          <tag><clip pos="1" side="tl" part="gen"/></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="lemh"/>
          <clip pos="1" side="tl" part="a_prn"/>
          <clip pos="1" side="tl" part="gen"/>
          <clip pos="1" side="tl" part="nbr"/>
          <lit-tag v="acc"/>
          <clip pos="1" side="tl" part="lemq"/>
        </lu>
      </chunk>
    </out>
  </action>
</rule>


  </section-rules>
</transfer>
