You can also make a t1x file that does *just* this job, if you don't
want to have to call that macro on every single rule. 

<?xml version="1.0" encoding="utf-8"?>
<transfer>
  <section-def-cats>
    <def-cat n="any">
      <cat-item tags="*"/>
    </def-cat>
   </section-def-cats>
   <!-- … other required sections … -->
  <section-rules>
    <rule c="variant cleanup">
      <pattern>
        <pattern-item n="any"/>
      </pattern>
      <action>
        <let><clip pos="1" side="tl" part="variety_tags"/><lit v=""/></let>
        <out>
          <lu>
            <clip pos="1" side="sl" part="whole"/>
            <lit v="/"/>
            <clip pos="1" side="tl" part="whole"/>
          </lu>
        </out>
      </action>
    </rule>
  </section-rules>
</transfer>

and in modes.xml, add

<program name="apertium-transfer -b" debug-suff="varclean"> <!-- add this -->
  <file name="apertium-bar-foo.foo-bar.variety.t1x"/> <!-- your new file -->
  <file name="foo-bar.variety.t1x.bin"/>
</program>

before your existing
<program name="apertium-transfer -b">
  <file name="apertium-bar-foo.foo-bar.t1x"/>
  <file name="foo-bar.t1x.bin"/>
</program>

> You can remove the tag with
>
> <let>
>   <clip pos="1" part="variety_tags" side="tl"/>
>   <lit v=""/>
> </let>
>
> Depending on how many words have these tags, you may want to put it in a
> macro so that all the other rules can refer to it.
>
> You can find more about t1x here:
> https://wiki.apertium.org/wiki/Contributing_to_an_existing_pair#Adding_structural_transfer_.28grammar.29_rules
> https://wiki.apertium.org/wiki/A_long_introduction_to_transfer_rules
>
> Daniel
>
> On Tue, Jan 20, 2026 at 1:46 PM Aure Séguier <[email protected]>
> wrote:
>
>> Hi,
>>
>> We are working on another way to manage occitan varieties in Apertium. To
>> do this, we added tags to words and paradigms lines which indicate the
>> variety (ex. : <par n="d:gascon"/>). The problem is, these tags prevent
>> the dgen to generate the right flexion in french. Thus, I would like to
>> remove them in the t1x file.
>>
>> I would like to write a rule like :
>> select all words with a tag "d:gascon", "d:lengadocian" or "d:aranese"
>> and remove it. But I have no idea how to do this. I can't understand how
>> the t1x file language works. All I could do is this :
>>     <def-cat n="variety_tags">
>>       <cat-item tags="d:gascon"/>
>>       <cat-item tags="d:lengadocian"/>
>>       <cat-item tags="d:aranese"/>
>>     </def-cat>
>>
>> Someone has an idea about how to write the rule ? And about where I can
>> find information about the language in the t1x file ?
>>
>> Thanks
>> --
>> Aure SÉGUIER
>>
>> Responsabla del pòle informatic
>>
>> Congrès permanent de la lenga occitana
>>
>>
>>
>> [image: mobilePhone] +33 (0)5 32 00 00 64 <+33%20(0)5%2032%2000%2000%2064>
>> [image: website] www.locongres.org <//www.locongres.org>
>> [image: address] La Ciutat - Creem! , 5-7 rue de la Fontaine, 64000 Pau
>>
>>
>>
>>
>> [image: facebook] <https://www.facebook.com/lo.congres>
>>
>> [image: twitter] <https://twitter.com/locongres>
>>
>> [image: linkedin]
>> <https://www.linkedin.com/company/congres-permanent-de-la-lenga-occitane/>
>>
>> [image: instagram] <https://www.instagram.com/locongres/>
>>
>>
>>
>> _______________________________________________
>> Apertium-stuff mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>>
>
> _______________________________________________
> Apertium-stuff mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/apertium-stuff
>



_______________________________________________
Apertium-stuff mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/apertium-stuff

Reply via email to