Difference between revisions of "Validating transfer files"

From Apertium
Jump to navigation Jump to search
(cat)
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
   
 
* Using an undefined variable, attribute or macro
 
* Using an undefined variable, attribute or macro
: e.g.: WARNING variable caseFirstWord doesent exist. Valid variables are: [number, case, genere]
+
: e.g.: ''WARNING variable caseFirstWord doesent exist. Valid variables are: [number, case, genere]''
  +
: e.g.: ''WARNING: Attribute a_np_acr is not defined. Valid attributes are: [a_nom, a_prp, a_adv, a_adj, a_vrb, a_vrb2...''
  +
: e.g.: ''WARNING: Macro f_bcond is not defined. Ignoring call. Defined macros are: [prnagradar, f_comparativa, ...''
  +
 
* Clipping at an invalid position (e.g. <clip pos="5"> when there are only 4 words)
 
* Clipping at an invalid position (e.g. <clip pos="5"> when there are only 4 words)
: e.g.: WARNING clip pos=4 is out of range. Replacing with an empty TransferWord.
+
: e.g.: ''WARNING clip pos=4 is out of range. Replacing with an empty TransferWord.''
  +
 
* Referencing a blank out of range (e.g. <b pos="4"/> when there are only 4 words)
 
* Referencing a blank out of range (e.g. <b pos="4"/> when there are only 4 words)
:: e.g. 'WARNING blank pos=1 is out of range. Replacing with a zero-space blank.'
+
: e.g.: ''WARNING blank pos=1 is out of range. Replacing with a zero-space blank.''
  +
 
* Invoking macros with wrong numer of parameters
 
* Invoking macros with wrong numer of parameters
  +
: e.g.: ''WARNING: Macro f_lexicadj is invoked with too few parameters. Adding blank parameters''
  +
 
* Invoking macros with an out-of-range parameter (e.g. <call-macro> <with-param pos="5"/> when there are only 4 words)
 
* 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.
+
See [[Bytecode for transfer/Evaluation on all released language pairs]] for some examples of errors on existing released language pairs.
   
   
 
You can easily check yourself if your transfer file contains errors.
 
You can easily check yourself if your transfer file contains errors.
  +
  +
[[Category:Documentation in English]]
   
   
Line 31: Line 40:
 
Compiling: javac -cp /usr/local/bin/../share/apertium/lttoolbox.jar ./apertium_eo_en_eo_en_t1x.java
 
Compiling: javac -cp /usr/local/bin/../share/apertium/lttoolbox.jar ./apertium_eo_en_eo_en_t1x.java
 
</pre>
 
</pre>
  +
  +
[[Category:Transfer]]

Latest revision as of 06:45, 24 September 2013

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
e.g.: WARNING variable caseFirstWord doesent exist. Valid variables are: [number, case, genere]
e.g.: WARNING: Attribute a_np_acr is not defined. Valid attributes are: [a_nom, a_prp, a_adv, a_adj, a_vrb, a_vrb2...
e.g.: WARNING: Macro f_bcond is not defined. Ignoring call. Defined macros are: [prnagradar, f_comparativa, ...
  • Clipping at an invalid position (e.g. <clip pos="5"> when there are only 4 words)
e.g.: WARNING clip pos=4 is out of range. Replacing with an empty TransferWord.
  • Referencing a blank out of range (e.g. when there are only 4 words)
e.g.: WARNING blank pos=1 is out of range. Replacing with a zero-space blank.
  • Invoking macros with wrong numer of parameters
e.g.: WARNING: Macro f_lexicadj is invoked with too few parameters. Adding blank 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 on existing released language pairs.


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