Difference between revisions of "Lttoolbox and lexc"

From Apertium
Jump to navigation Jump to search
Line 71: Line 71:
LEXICON RegNounInfl
LEXICON RegNounInfl


:+N+Sg # ;
+N+Sg: # ;
s:+N+Pl # ;
+N+Pl:s # ;
</pre>
</pre>


Line 78: Line 78:


<pre>
<pre>
$ hfst-lexc test.lexc -o test.hfst
$ hfst-lexc test.lexc -o test.gen.hfst
$ hfst-invert -i test.gen.hfst -o test.mor.hfst


$ echo "cat" | hfst-lookup test.hfst
$ echo "cat" | hfst-lookup test.mor.hfst
cat cat+N+Sg
cat cat+N+Sg


$ echo "cats" | hfst-lookup test.hfst
$ echo "cats" | hfst-lookup test.mor.hfst
cats cat+N+Pl
cats cat+N+Pl
</pre>
</pre>

Revision as of 14:41, 17 August 2011

This page describes some how lttoolbox and HFST's lexc are similar, so that people more familiar with one can get to grips more easily with the other.

Terminology

lttoolbox lexc Notes
Paradigm Continuation lexicon So each time you see LEXICON foo, think <pardef n="foo"/>
Section Root lexicon
Left Up Both left and upper correspond to surface form
Right Down Corresponds to lexical form
Symbol Multichar symbol Sequences of one or more symbol which are treated as one symbol

Example

lttoolbox

<dictionary>
  <sdefs>
    <sdef n="n"/>
    <sdef n="pl"/>
    <sdef n="sg"/>
  </sdefs>
  <pardefs> 
    <pardef n="RegNounInfl">
      <e><p><l/><r><s n="n"/><s n="sg"/></r></p></e>
      <e><p><l>s</l><r><s n="n"/><s n="pl"/></r></p></e>
    </pardef>
  </pardefs>
  <section id="Root" type="standard">
    <e lm="cat"><i>cat</i><par n="RegNounInfl"/></e> <!-- A noun -->
  </section>
</dictionary>

And to compile and use this dictionary:

$ lt-comp lr test.dix test.bin
Root@standard 7 7

$ echo "cat" | lt-proc test.bin
^cat/cat<n><sg>$

$ echo "cats" | lt-proc test.bin
^cats/cat<n><pl>$

lexc

Multichar_Symbols

 +N +Pl +Sg

LEXICON Root

NounRoot ;

LEXICON NounRoot

cat RegNounInfl ; ! A noun

LEXICON RegNounInfl

+N+Sg:   # ;
+N+Pl:s   # ;

And to compile and use this dictionary:

$ hfst-lexc test.lexc -o test.gen.hfst
$ hfst-invert -i test.gen.hfst -o test.mor.hfst

$ echo "cat" | hfst-lookup test.mor.hfst 
cat	cat+N+Sg

$ echo "cats" | hfst-lookup test.mor.hfst 
cats	cat+N+Pl