From Apertium
Revision as of 15:46, 24 August 2019 by Francis Tyers (talk | contribs)
Jump to navigation Jump to search

Sometimes you want to be able to merge two tokens in output, for example for contractions, e.g. de + el = del.

You can do this using the postgenerator.

First make sure you add the postgenerator wakeup symbol to your monolingual dictionary, e.g.

   <pardef n="/de__pr">
     <e r="LR"><p><l>de</l><r>de<s n="pr"/></r></p></e>
     <e r="RL"><p><l><a/>de</l><r>de<s n="pr"/></r></p></e>


   <e lm="de"><i></i><par n="/de__pr"/></e>


You should get entries like:


from lt-expand

<?xml version="1.0" encoding="UTF-8"?>
    <sdef n="test"/>
  <section id="main" type="standard">

     <e> <p><l><a/>de<b/>el</l><r>del</r></p></e>

You can compile it like:

$ lt-comp lr aaa.autopgen.bin
main@standard 7 6

And use it like:

$ echo "~de el" | lt-proc -p aaa.autopgen.bin 

In your modes file:

      <program name="lt-proc $1">
        <file name="aaa-bbb.autogen.bin"/>
      <program name="lt-proc -p">
        <file name="aaa-bbb.autopgen.bin"/>