Difference between revisions of "Integration and tagset conversion with Giellatekno"

From Apertium
Jump to navigation Jump to search
Line 102: Line 102:
   
 
* '''Don't''' do tag substitution in your constraint grammar. That means no using <code>SUBSTITUTE</code> rules to change tags. If you are missing a reading that you would like to select, add it to your morphological analyser.
 
* '''Don't''' do tag substitution in your constraint grammar. That means no using <code>SUBSTITUTE</code> rules to change tags. If you are missing a reading that you would like to select, add it to your morphological analyser.
  +
* '''Do''' convert to Apertium-style and analysis style wherever humanly feasible.
   
 
[[Category:Development]]
 
[[Category:Development]]

Revision as of 11:29, 11 November 2015

One language pair setup nowadays is using transducers from Giellatekno and pair-specific data in Apertium. This is a tricky set up because there is a lot of machinery around the tagset conversion.

Let's assume you're using giella-xxx, giella-yyy and apertium-xxx-yyy, what are the relevant files ?

Files

Giellatekno side

  • giella-xxx/tools/mt/apertium: This is where all the relabelled transducers live.
    • giella-xxx/tools/mt/apertium/tagsets: These are the different files used for relabelling the transducers.
      • giella-xxx/tools/mt/apertium/tagsets/apertium.postproc.relabel: This file is used for 1:1 tag conversions. For example if you want to change <cc> to <cnjcoo>.
      • giella-xxx/tools/mt/apertium/tagsets/modify-tags.regex: This file is used for 1:1, 1:n and n:1 tag conversions. For example if you want to change <sg3> to <p3><sg>. This is also used if you need to do context-sensitive replacement, for example for specific lemmas ,<clb> to ,<cm>.

Apertium side

  • apertium-xxx-yyy/gt2apertium.cg3r: This file is used for converting the CG file tags to Apertium tags. You may have to convert tags in more than one place.

Relevant files

apertium.postproc.relabel

This file is a simple file that is two column, tab separated and processed by hfst-substitute, if you want to change a single tag or remove a single tag, then this is the file:

<cc>    <cnjcoo>
modify-tags.regex

This file is more complicated and allows you more flexibility

[
  [ %<clb%> -> %<cm%> || %, _ ] .o.
  [ %<n%> %<prop%> -> %<np%> ]
] ;

This sample changes the sequence <n><prop> to <np>, and the sequence ,<clb> to ,<cm>.

NOTE: modify-tags.regex is run after apertium.postproc.relabel so keep this in mind.

gt2apertium.cg3r

todo

Testing and troubleshooting

A lot of the time it takes a lot of time and patience to get the tags as they should be. Here are some tips for checking which file you need to look in.

Apertium side

Check the trimmed analyser

$ echo , | hfst-lookup xxx-yyy.automorf.hfst 
,	,<cm>	0,000000

If this comes out as an unknown word, then the fault is probably in your bilingual dictionary apertium-xxx-yyy.xxx-yyy.dix. You can grep for the analysis using something like:

$ lt-expand apertium-xxx-yyy.xxx-yyy.dix | grep '<cm>'
,<cm>:,<cm>

If the word comes out but has the wrong tag, then the fault is probably in one of the Giellatekno relabel scripts, see the files as described above in giella-xxx/tools/mt/apertium/tagsets.

Check the untrimmed analyser

$ echo , | hfst-lookup .deps/xxx.automorf.hfst
,	,<cm>	0,000000

If the word comes out with the wrong tag here, then again the fault is probably in one of the Giellatekno relabel scripts, see the files as described above in giella-xxx/tools/mt/apertium/tagsets.

Giellatekno side

Check the relabelled analyser

$ echo , | hfst-lookup tools/mt/apertium/analyser-mt-apertium-desc.yyy.hfstol 
,	,<cm>	0,000000

If the word comes out with the wrong tag here, then again the fault is probably in one of the Giellatekno relabel scripts, see the files as described above in giella-xxx/tools/mt/apertium/tagsets.

If you have fixed the relabel scripts and it still isn't working, then it could be because you are not calling the relabel scripts in tools/mt/apertium/tagsets/Makefile.am, or it could be because you have some multicharacter symbol which is not declared in src/morphology/root.lexc.

Check the unrelabelled analyser

$ echo , | hfst-lookup  src/analyser-gt-desc.hfstol 
,	,+CLB	0,000000

If the word comes out with the wrong tag here, then again the fault is probably in one of the lexc source files, you can find them in giella-xxx/src/morphology/

Pro tips

  • Don't do tag substitution in your constraint grammar. That means no using SUBSTITUTE rules to change tags. If you are missing a reading that you would like to select, add it to your morphological analyser.
  • Do convert to Apertium-style and analysis style wherever humanly feasible.