Difference between revisions of "Hfst-minimise trick"

From LING073
Jump to: navigation, search
Line 5: Line 5:
 
* In the rule for making <code>$(LANG1).automorf.hfst</code>, pipe the output of <code>hfst-invert</code> into <code>hfst-minimise</code> before piping the output of that into <code>hfst-fst2fst</code>.  So the relevant part of this line should now look something like this:
 
* In the rule for making <code>$(LANG1).automorf.hfst</code>, pipe the output of <code>hfst-invert</code> into <code>hfst-minimise</code> before piping the output of that into <code>hfst-fst2fst</code>.  So the relevant part of this line should now look something like this:
 
*: ...<code>| hfst-invert | hfst-minimise | hfst-fst2fst -O -o $</code>
 
*: ...<code>| hfst-invert | hfst-minimise | hfst-fst2fst -O -o $</code>
−
* In the rule for <code>$(LANG1).autogen.att.gz</code>, first run <code>hfst-minimise</code> on the input before piping that into <code>hfst-fst2txt</code>.  That rule should now look something like this:
+
* In the rule for <code>$(LANG1).autogen.hfst</code>, first run <code>hfst-minimise</code> on the input before piping that into <code>hfst-fst2fst</code>.  That rule should now look something like this:
−
*: <code>hfst-minimise $< | hfst-fst2txt | gzip -9 -c -n > $@</code>
+
*: <code>hfst-minimise $< | hfst-fst2fst -O -o $@</code>
 
* Run <code>make clean</code>, reinitialise your module (<code>./autogen.sh</code>), and run <code>make</code> to recompile.
 
* Run <code>make clean</code>, reinitialise your module (<code>./autogen.sh</code>), and run <code>make</code> to recompile.
 
* Test the output of <code>lt-proc</code> and <code>hfst-proc</code> again.
 
* Test the output of <code>lt-proc</code> and <code>hfst-proc</code> again.
  
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Revision as of 17:59, 30 March 2017

There's a "trick" using hfst-minimise that will get around some issues in converting hfst-format transducers to lttoolbox-format transducers. That is, if hfst-proc xyz.automorf.hfst and lt-proc xyz.automorf.bin seem to be acting differently, try this trick.

The trick

In your Makefile.am file:

  • In the rule for making $(LANG1).automorf.hfst, pipe the output of hfst-invert into hfst-minimise before piping the output of that into hfst-fst2fst. So the relevant part of this line should now look something like this:
    ...| hfst-invert | hfst-minimise | hfst-fst2fst -O -o $
  • In the rule for $(LANG1).autogen.hfst, first run hfst-minimise on the input before piping that into hfst-fst2fst. That rule should now look something like this:
    hfst-minimise $< | hfst-fst2fst -O -o $@
  • Run make clean, reinitialise your module (./autogen.sh), and run make to recompile.
  • Test the output of lt-proc and hfst-proc again.