Difference between revisions of "Validating transfer files"

From Apertium
Jump to navigation Jump to search
(Created page with ' You can check if your transfer file contains errors. First, install lttoolbox-java. Then type <pre> $ apertium-preprocess-transfer-bytecode-j apertium-eo-en.eo-en.t1x aper…')
 
Line 1: Line 1:
   
  +
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:
You can check if your transfer file contains errors.
 
  +
  +
* 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. <b pos="4"/> 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)
  +
  +
 
You can easily check if your transfer file contains errors.
  +
   
 
First, install [[lttoolbox-java]].
 
First, install [[lttoolbox-java]].
 
Then type
 
Then type
  +
$ apertium-preprocess-transfer-bytecode-j your-file.t1x anything.class
  +
  +
  +
Example finding an undefined attribute:
   
 
<pre>
 
<pre>

Revision as of 01:38, 28 February 2010

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)


You can easily check 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

See Bytecode for transfer/Evaluation on all released language pairs.