Difference between revisions of "Partial hack for prefix inflection"

From Apertium
Jump to navigation Jump to search
(New page: {{TOCD}} This is a description of a partial hack for dealing with prefix inflection. Essentially it re-uses as much as possible components that we already have, although requires one more ...)
 
Line 3: Line 3:
   
 
The first dictionary would be written in the normal manner, the second dictionary would be auto-generated from the first by means of lt-expand output coupled with the pretagger output.
 
The first dictionary would be written in the normal manner, the second dictionary would be auto-generated from the first by means of lt-expand output coupled with the pretagger output.
 
The pipeline would look like this:
 
   
 
==Analysis==
 
==Analysis==
Line 111: Line 109:
 
</dictionary>
 
</dictionary>
 
</pre>
 
</pre>
  +
  +
  +
[[Category:Development]]

Revision as of 22:17, 20 December 2007

This is a description of a partial hack for dealing with prefix inflection. Essentially it re-uses as much as possible components that we already have, although requires one more component, a pretagger module.

The first dictionary would be written in the normal manner, the second dictionary would be auto-generated from the first by means of lt-expand output coupled with the pretagger output.

Analysis

$ echo "watu" | lt-proc sw.automorf.bin
^watu/m<pl>tu<n>$

This would then be passed through the pretagger which would re-order the output thus:

^watu/mtu<n><pl>$

Basically just shunting all the tags to the end. This is now ready to be passed to the tagger.

Generation

Slightly more complicated. Out of final stage transfer you get:

^mtu<n><pl>$

This is then passed through the dictionary 2:

$ echo "^mtu<n><pl>$" | lt-proc -g sw.automangle.bin 
m<pl>tu<n>

Note: obviously we're missing the '^' and '$' here, but thats fairly straightforward to add.

Then it is passed through dictionary 1 in generation mode:

$ echo "^m<pl>tu<n>$" | lt-proc -g sw.autogen.bin
watu

Dictionaries

Dictionary 1 (sw-1.dix)

Compile
$ lt-comp lr sw.dix sw.automorf.bin
$ lt-comp rl sw.dix sw.autogen.bin
<dictionary>
  <alphabet>abcdefghijklmnopqrstuvwxyz</alphabet>
  <sdefs>
    <sdef n="n"/>
    <sdef n="sg"/>
    <sdef n="pl"/>
  </sdefs>
  <pardefs>
    <pardef n="C__1_2__n">
      <e><p><l>m</l><r>m<s n="sg"/></r></p></e>
      <e><p><l>wa</l><r>m<s n="pl"/></r></p></e>
    </pardef>

    <pardef n="mtu__n">
      <e><p><l/><r><s n="n"/></r></p></e>
    </pardef>
  </pardefs>
  <section id="main" type="standard">
    <e lm="mtu"><par n="C__1_2__n"/><i>tu</i><par n="mtu__n"/></e>
  </section>
</dictionary>

Dictionary 2 (sw-2.dix)

Compile
$ lt-comp lr sw-2.dix sw.automangle.bin
<dictionary>
  <alphabet>abcdefghijklmnopqrstuvwxyz</alphabet>
  <sdefs>
    <sdef n="n"/>
    <sdef n="sg"/>
    <sdef n="pl"/>
  </sdefs>

  <section id="main" type="standard">
    <e>
      <p>
        <l>mtu<s n="n"/><s n="sg"/></l>
	<r>m<s n="sg"/>tu<s n="n"/></r>
      </p>
    </e>
    <e>
      <p>
        <l>mtu<s n="n"/><s n="pl"/></l>
	<r>m<s n="pl"/>tu<s n="n"/></r>
      </p>
    </e>
  </section>
</dictionary>