Validating transfer files
Revision as of 02:01, 28 February 2010 by Jacob Nordfalk (talk | contribs)
A lot of language pairs contains errors which cant be found by apertium-validate-transfer, but which is found by the Bytecode for transfer compiler. This includes:
- Using an undefined variable, attribute or macro
- Clipping at an invalid position (e.g. <clip pos="5"> when there are only 4 words)
- Referencing a blank out of range (e.g. when there are only 4 words)
- Invoking macros with wrong numer of parameters
- Invoking macros with an out-of-range parameter (e.g. <call-macro> <with-param pos="5"/> when there are only 4 words)
See Bytecode for transfer/Evaluation on all released language pairs for some examples of errors.
You can easily check yourself if your transfer file contains errors.
First, install lttoolbox-java.
Then type
$ apertium-preprocess-transfer-bytecode-j your-file.t1x anything.class
Example finding an undefined attribute:
$ apertium-preprocess-transfer-bytecode-j apertium-eo-en.eo-en.t1x apertium_eo_en_eo_en_t1x.class Parsing apertium-eo-en.eo-en.t1x // WARNING: Attribute a_np_acr is not defined. Valid attributes are: [a_nom, a_prp, a_adv, a_adj, a_vrb, a_vrb2, a_det, a_ord, a_prn, a_tns, a_nepersonaj_tempoj, a_gen, a_prs, a_nbr, a_cas, lem, lemq, lemh, whole, tags, chname, chcontent, content] // Replacing with error_UNKNOWN_ATTR - for <transfer default="chunk">/<section-def-macros>/<def-macro n="firstWord" npar="1">/<choose>/<when>/<test>/<equal>/<clip part="a_np_acr" pos="1" side="sl"> Compiling: javac -cp /usr/local/bin/../share/apertium/lttoolbox.jar ./apertium_eo_en_eo_en_t1x.java