Apertium-quality/Configuration

From Apertium
Jump to navigation Jump to search

Apertium Quality XML Configuration Format

Introduction

The apertium quality configuration format is a fairly simple XML format for declaring which files are required for running an automatic test, or however another tool uses the data.

The format is essentially as follows:

<config>
  <test-type>
    <content attribs=stuff />
  </test-type>
<config>

Currently supported test types:

  • coverage
  • tagging
  • regression
  • morph

Currently supported content elements:

  • test
  • corpus

For a more detailed overview, see the schema.

Example

Here is a template of the XML file:

<config xmlns="http://apertium.org/xml/quality/config/0.1">
</config>

This simple document takes several elements dependant on the type of file you want to declare for each test.

<config xmlns="http://apertium.org/xml/quality/config/0.1">
    <coverage>
        <corpus generator="gencrp.py" language="mt-he" path="relative-level-crp.txt" />
        <corpus generator='someotherscript.bash' language="mt-he" path="../belowhere.crp.txt />
    </coverage>
    <regression>
        <test language="mt-he" path="http://whatever/test.xml" />
        <test language="mt-he" path="localfile.xml" />
    </regression>
</config>

Regression Test Format

The format for creating regression tests is extremely simple. It is simply a Mediawiki template called test.

Example

The parameters are pipe-delimited as follows:

{{test|<language>|<original text>|<expected result>}}

or

{{test|<language>|<original text>|<expected result>|<comment>}}

.

An example of usage:

* {{test|fr|I am three years old.|J'ai trois ans.|Checks correct verb use}}

The above shows up on the wiki as:

  • (fr) I am three years old. → J'ai trois ans. :: Checks correct verb use.


Usage as Regression Test

In order to access your wiki page as a regression test, simply add Special:Export between wiki/ and your page name. For example, http://wiki.apertium.org/wiki/French_and_Breton/Regression_tests becomes http://wiki.apertium.org/wiki/Special:Export/French_and_Breton/Regression_tests. Simply paste that link as the parameter to aq-regtest and you're good to go.