Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RegTestUtils.pm « perllib « tests « regression-testing - github.com/moses-smt/mosesdecoder.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25e7f5e537cd5e49730acbab90ddceef7131e6be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#RegTestUtils.pm: for moses regression testing
#Evan Herbst, 8 / 11 / 06

use strict;

package RegTestUtils;
return 1;

###############################################################

#arguments: chomped line of output that gives the best hypo and various scores
#return: a string to be compared with the correct total hypothesis score;
# it's formatted as a double if no error, or "FORMAT ERROR" if there is one
sub readHypoScore
{
	my $line = shift;
	#the 0.12 is hardcoded in Hypothesis.cpp because some parsing scripts still
	#expect a comma-separated list of scores -- EVH
	if($line =~ /\[total=\s*(-?\d+\.\d+)\]/) {return $1;}
	return "FORMAT ERROR";
}

#arguments: chomped line of output that gives a time in seconds
#return: a string to be compared with the correct time;
# it's formatted as a double if no error, or "FORMAT ERROR" if there is one
sub readTime
{
	my $line = shift;
	if($line =~ /\[(\d+\.\d+)\]\s*seconds$/) {return $1;}
	return "FORMAT ERROR";
}