Testing tools for the sámi language technology project

- Technical documentation -

This page documents the scripts and the Makefile used as test tools. There are five perl scripts, all located in $CVSROOT/gt/script/testing/, and a Makefile, one copy for each language, located in $CVSROOT/gt/smX/testing/ (where smX is the ISO code of your favorite Saami language). The South Saami (sma) Makefile is used as the development version, and serves as the original, from which the others are copied.

Below is only described the calling and the return values of the different scripts, for details, see the scripts themselves, they are pretty simple, and fairly well commented (and if not, complain to me).

Table of Content

1. merge-codesNforms.pl

Purpose:

To create a base file for making test cases by combining a tag list and a word form list. This way we only have to write the tag list once for each POS.

Input:

Output stream:

A repeating, tab-separated list of fields (three fields), each such triple separated with a newline:

Usage

Used in front of one of:

to create the actual test cases, and the corresponding facit files.

2. merge-codesNword.pl

Purpose:

To create the input file for generating a paradigm by combining a tag list and a base form of a given word.

Input:

Output stream:

A list of baseform plus codes corresponding to the whole paradigm. There is one such combination on each line.

Usage

The output can be directly used as input for xfst, to generate the word forms that make up the paradigm.

3. make-gen-test.pl

Purpose:

To extract from a created testbase file the separate parts needed as input data for testing word form generation.

Input:

A testbase file created with 1. merge-codesNforms.pl, with the three fields baseform, inflectional codes, and word form(s) corresponding to the inflectional codes.

Output stream:

Test file for word form generation testing: one line for each inflection, consisting of baseform and inflectional codes appended. This is the input format required by the Xerox xfst tool.

Usage

Use as input to the Xerox xfst tool (done in the Makefile).

4. make-gen-test-facit.pl

Purpose:

To create the expected output from a generation test run, such that the actual test results can be compared with it. Based on the comparison, one can make further reports on the success of the test run.

Input:

Testbase file as created above.

Output stream:

A list of word forms in the same format as produced by the Xerox tools, extracted from the testbase file. One word form on each line.

Usage

Use the output of this script to diff against the actual test result (done in the Makefile). Any differences indicate possible errors in the morphological description.

5. make-ana-test.pl

Purpose:

To create a test file (or a facit file) for morphological analysis by spitting out all the possible word forms with the corresponding analysis at the end, formated almost as the output from the Xerox xfst tool. Some further postprocessing is needed both for making the test case, and for creating the facit file. This is done in the Makefile.

Input:

A testbase file as created above.

Output stream:

A two-field, tab-separated list:

In cases where there are more than one alternative wordform, they have been split onto separate lines.

Usage

Use to create the basis for word form analysis testing. Further sorting and cutting (field 1 as test data, field 2 as facit data) is needed, and is done in the Makefile.

6. Makefile

Whereas the perl scripts above are pretty short and simple, the Makefile used to automatise testing is pretty long and complex. Thus, the documentation is split into the following sections:

Flow diagram for testing

Below is outlined the flow of action for the test bed. The example file is from South Sami, but the flow itself is language independent. The flow diagram illustrates word form generation.

            -----------    ===========           The corresponding
   "Files", | Scripts |  & || Tools ||              make target
==================================================================
"noun-codes.txt"  "n-even-col6-ie-full.txt"
        \                 |
         ------------------------
         | merge-codesNforms.pl |
         ------------------------
                     ||
                     \/
    "n-even-col6-ie-full.testbase"                 n-%.testbase
       ||                  ||
       ||                  \/
       ||       ------------------------
       ||       |   make-gen-test.pl   |
       ||       ------------------------
       ||                  ||
       ||                  \/
       ||      "n-even-col6-ie-full.gtest"            %.gtest
       ||                  ||
       ||                  \/
       ||   ------------------------------------
       ||   | n-even-col6-ie-full-gtest-script |
       ||   ------------------------------------
       ||                  ||
       ||                  \/
       ||            ==============
       ||            ||   xfst   ||
       ||            ==============
       ||                  ||
       ||                  \/
       ||        "n-even-col6-ie-full.gresult"       %.gresult
       ||                              ||
       \/                              ||
  --------------------------           ||
  | make-gen-test-facit.pl |           ||
  --------------------------           ||
                 ||                    ||
                 \/                    ||
      "n-even-col6-ie-full.gfacit"     ||            %.gfacit
                        ||             ||
                        \/             \/
                        =================
                        ||     diff    ||
                        =================
                                ||
                                \/
                  "n-even-col6-ie-full.greport"      %.greport
                                ||
 all *.greport files - \  \  \  \/  / /  /
                        =================
                        ||     cat     ||
                        =================
                                ||
                                \/
                          "n-g.summary"             n-g.summary

The above scheme is repeated more or less identical for word form analysis, with the exception that there is no separate -facit.pl script - the same script is used for producing both test input and test facit, with the help of some postprocessing in the Makefile.

The scheme for paradigm generation is much simpler, and it should be possible to read the Makefile directly. If not, complain to me!

Variables Used

Predefined Variables

The following built-in variables are used:

$@
Contains the name of the target, is often used to redirect output to a file named the same as the target.
%
(Strictly speaking not a variable:) Wildcard in target and dependency statements. When used as a wildcard in a target, the string it represents will be inserted in its place in names of dependencies. Often used to make one target for many similarly named files/targets.
$<
Represents the first element in a list of dependencies.
$^
Holds the name of all dependencies.
$*
Holds the string matched by % in a target name.
MAKE
Holds the pathname of the make program used. This is useful f.ex. when starting a make command in another directory from within a Makefile, to ensure they are using the same make.
Variables I have defined

The following variables defined by me are used:

SHELL
The location of the shell program. The use of this variable (set to this value) is recommended in the make documentation. That's why.
BINDIR
The location of the directory that holds the scripts used in testing.
TEMP
The location of the directory for storing temporary files (so that it can easily be redefined).
SAVEFILE
A variable containing the (computed) name of the save file used during testing. The computed content of this variable makes the reference to the save file language independent.
UMASK
Something I have copied from a Lingsoft makefile. I do not understand exactly what it does, and whether we need it. It does not seem to do any harm, so it is left for the time being.
WORD
An empty variable to be filled/set by the user (on the command line) when generating a paradigm.
NGenFiles
NAnaFiles
VGenFiles
VAnaFiles
AGenFiles
AAnaFiles
Variables whose content is a list of target names (one for each POS, analysis and generation) calculated from (existing) file names. This is to circumvent a problem with being able to trigger the making of some files, due to the non-existence of other files (I have forgotten the details, but with it works, without it doesn't. Trust me.). If you are curious, see the make documentation.

When defined, the variable names are written as such, when referenced, they are encapsulated in parenthesis, and prefixed with a dollar sign. Example: $(TEMP) is how the variable TEMP is referenced.

Main sections of the Makefile

The main sections of the Makefile are the following:


sjurnm@mac.com
Last modified: Mon Jun 24 15:28:28 CEST 2002