• AlignmentEval class This is a hash with the name of the seven measures ([sure|possible]
[Precision|Recall|FMeasure] and AER) and their value. You use its methods to display
and c ompare evaluation results:
– display sub Prints the measures in a table. The arguments are:
* evaluationMeasure: ref to the evaluationResult object
* fileHandle: where you want print it (optional, default:STDOUT)
* format: for now only “text” available (optional)
– compare sub Prints in a comparative table the results of various evaluations. The
arguments are:
* results: ref to an array of arrays. The first array has one entry for each result
set, the s econd one has 2 entries (the evaluationResult object reference and a string
describing the experiment), ie
[[$refToAlignmentEval1,’description1’], [$refToAlignmentEval2,’description2’],...]
* title: A title which appears above the table
* fileHandle: same as in display
* format: “text” or “latex” (optional, default “text”)
Code samples for evaluation routines:
# Creating an evaluationResult object and pushing it into the evaluation array:
$evaluationResult=$s2e->evaluate($goldStandard,"no-null-align");
push @evaluation,[$evaluationResult,"Non weighted"];
# Doing the same in one step:
push @evaluation,[$s2e->evaluate($goldStandard,"no-null-align",1),"Weighted"];
# Displaying in a table the two result lines:
Lingua::AlignmentEval::compare(\@evaluation,"My experiments",\*STDOUT,"latex");
2.6 Alignment processing
• processAlignment method
Allows to process the AlignmentSet applying a function to the alignment of each sentence
pair of the s et. The Alignment.pm module contains such functions:
General subroutines:
– forceGroupConsistency: prohibits situations of the type: if linked(e,f) and
linked(e’,f) and linked(e’,f’) but not linked(e,f’). In this case the function links
e and f’.
– swapSourceTarget: swaps source and target in the alignments (transforms a link
(6 3) in (3 6)).
– regexpReplace: Substitutes, in a side of the corpus, a string (defined by a regular
expression) by another and updates the links accordingly. There are 3 arguments:
the regular expressions (pattern and replacement) and the side (source or target)
(see the man examples). Notes:
∗ In case of deleting various words, all added words are linked to all positions
to which deleted words were linked. $al− > sourceLinks information can be
lost for replaced words.
∗ The regexp is applied to the side of the corpus, and the smallest set of additions
and deletions necessary to turn the original word sequence into the modified
one is computed using algorithm::diff. In practice, this set is not always mini-
mal, and in these cases various words are replaced by various so links may be
changed. To avoid this problem use replaceWords subroutine.
∗ Is more eficient in ”source” side than in ”target” side.
13