Branch Coverage

blib/lib/Lingua/AlignmentSet.pm
Criterion Covered Total %
branch 94 476 19.7


line true false branch
47 0 2 if (not defined $format) { }
49 1 1 unless (defined $range)
50 1 1 if ($format eq 'BLINKER')
61 0 2 if ($format eq 'GIZA') { }
1 1 elsif ($format eq 'BLINKER') { }
1 0 elsif ($format eq 'NAACL') { }
0 0 elsif ($format eq 'TALP') { }
119 0 0 unless (defined $outputFH)
120 0 0 if ($representation eq 'matrix')
121 0 0 unless (defined $mark)
122 0 0 unless (defined $maxRows)
123 0 0 unless (defined $maxCols)
127 0 0 if ($format eq 'latex')
136 0 0 if ($$alSet{'format'} ne 'GIZA' and not $$FH{'source'} && $$FH{'target'})
144 0 0 if ($representation eq 'matrix') { }
0 0 elsif ($representation eq 'enumlinks') { }
153 0 0 if ($format eq 'latex')
162 0 0 if ($$alSet{'format'} eq 'GIZA') { }
0 0 elsif ($$alSet{'format'} eq 'NAACL' or $$alSet{'format'} eq 'BLINKER' or $$alSet{'format'} eq 'TALP') { }
166 0 0 unless ($$alSet{'location'}{'source'})
216 1 0 unless (defined $weighted)
230 0 1 if ($$answerAlSet{'format'} eq 'NAACL' and $alignMode eq 'as-is' and $$answerAlSet{'firstSentPair'} == 1) { }
231 0 0 unless my $answerFH = 'IO::File'->new('<' . $$answerAlSet{'location'}{'sourceToTarget'})
237 0 0 if ($answerFH->eof)
243 0 0 if ($$answerAlSet{'lastSentPair'} eq 'eof') { }
278 0 1 if ($$submissionAlSet{'format'} eq 'NAACL' and $alignMode eq 'as-is' and $$submissionAlSet{'firstSentPair'} == 1) { }
279 0 0 unless my $submissionFH = 'IO::File'->new('<' . $$submissionAlSet{'location'}{'sourceToTarget'})
286 0 0 if ($submissionFH->eof)
292 0 0 if ($$submissionAlSet{'lastSentPair'} eq 'eof') { }
337 0 1 if ($weighted)
379 0 1 if ($weighted) { }
413 54 5 if (defined $sureAnswer{$alignment})
414 54 0 if (not $weighted) { }
422 54 5 if (defined $sureAnswer{$alignment} or defined $possibleAnswer{$alignment})
423 54 0 if (not $weighted) { }
431 54 5 if (defined $sureAnswer{$alignment})
432 54 0 if (not $weighted) { }
440 1 0 if (scalar keys %sureSubmission != 0) { }
445 1 0 if (scalar keys %sureAnswer != 0) { }
450 1 0 if ($sureRecall != 0 and $surePrecision != 0) { }
458 1 0 if (scalar(keys %sureSubmission) + scalar(keys %possibleSubmission) != 0) { }
463 1 0 if (scalar(keys %sureAnswer) + scalar(keys %possibleAnswer) != 0) { }
468 1 0 if ($possibleRecall != 0 and $possiblePrecision != 0) { }
475 1 0 if (scalar(keys %sureSubmission) + scalar(keys %possibleSubmission) != 0) { }
489 0 0 if (ref $AlignmentSub eq 'ARRAY')
490 0 0 if ($$AlignmentSub[0] eq 'Lingua::Alignment::eliminateWord')
491 0 0 if (@$AlignmentSub < 3) { }
494 0 0 unless ($$alSet{'location'}{$side} and $$newLocation{$side})
505 0 0 unless (defined $selectSubgroups)
506 0 0 unless (defined $alignMode)
507 0 0 unless (defined $$globals{'minPhraseFrequency'})
508 0 0 unless (defined $$globals{'extendGroups'})
509 0 0 unless (defined $$globals{'onlyGroups'})
510 0 0 unless (defined $$globals{'defaultActionGrouping'})
511 0 0 unless (defined $$globals{'defaultActionGeneral'})
512 0 0 unless (defined $$globals{'verbose'})
521 0 0 if ($selectSubgroups == 0)
539 0 0 unless ($selectSubgroups)
546 0 0 if ($$globals{'onlyGroups'} == 0)
568 0 0 if ($verbose > 0)
583 0 0 if ($j <= @{$$al{'sourceAl'};})
584 0 0 if ($j == @{$$al{'sourceAl'};}) { }
590 0 0 if ($newAnchorSource - $lastAnchorSource != 1 and not $sourcePerturbed{$lastAnchorSource + 1}) { }
0 0 elsif ($newAnchorTarget - $lastAnchorTarget != 1 and not $targetPerturbed{$lastAnchorTarget + 1}) { }
595 0 0 unless ($al->isAnchor($i, 'target'))
597 0 0 unless ($anchorsInTarget)
599 0 0 if ($newPerturbationDetected)
621 0 0 if ($selectSubgroups) { }
624 0 0 if (do { ($ruleApplied = $perturbation->applyGrouping($groupKeys, $subGroupKeys, $globals)) > 0 }) { }
632 0 0 if ($ruleApplied == -1) { }
644 0 0 if ($ind > 0)
649 0 0 if ($ind > 0)
662 0 0 if ($newFormat eq 'NAACL' and not $selectSubgroups)
663 0 0 if (exists $$newFH{'source'})
666 0 0 if (exists $$newFH{'target'})
675 0 0 if ($internalSentPairNum % 1000 == 0) { }
0 0 elsif ($internalSentPairNum % 100 == 0) { }
679 0 0 if ($verbose > 0)
680 0 0 if ($selectSubgroups)
682 0 0 if ($verbose > 0)
686 0 0 if ($$globals{'onlyGroups'} == 0)
696 0 0 if ($selectSubgroups == 0)
700 0 0 if ($selectSubgroups) { }
701 0 0 if ($verbose > 0)
702 0 0 unless open GROUPS, ">$ENV/groups"
705 0 0 if ($count >= $$globals{'minPhraseFrequency'})
709 0 0 if ($$globals{'onlyGroups'} == 0)
710 0 0 unless open SUBGROUPS, ">$ENV/subGroups"
713 0 0 if ($count >= $$globals{'minPhraseFrequency'})
729 0 0 if (not defined $newFormat) { }
736 0 0 if ($verbose > 0)
739 0 0 unless open CS, "<$corpSrc"
740 0 0 unless open CT, "<$corpTrg"
752 0 0 if ($verbose > 0)
763 0 0 if ($newcorp{$pair})
768 0 0 if ($cntToFind == 0)
769 0 0 if ($verbose > 0)
773 0 0 if ($verbose > 0)
774 0 0 if ($inputSentPairNum % 100000 == 0)
775 0 0 if ($inputSentPairNum % 10000 == 0)
778 0 0 if ($verbose > 0)
787 0 0 if (exists $found{"$s ||| $t"}) { }
808 0 0 if (not defined $newFormat) { }
816 0 0 unless open CS, "<$corpSrc"
817 0 0 unless open CT, "<$corpTrg"
827 0 0 if ($verbose > 0)
840 0 0 if (not $newcorp{"$s ||| $t"}) { }
849 0 0 if ($verbose > 0)
865 0 0 if ($verbose > 2)
866 0 0 if ($verbose > 2)
868 0 0 if ($numcs < $sMin or $numcs > $sMax or $numct < $tMin or $numct > $tMax) { }
886 0 0 if ($sLcs == 0 or $tLcs == 0) { }
892 0 0 if ($verbose > 1)
898 0 0 if ($lcs > $bestLcs) { }
0 0 elsif ($lcs == $bestLcs) { }
908 0 0 if ($verbose > 1)
909 0 0 if ($cnt2 > 0 and $cnt2 % 100000 == 0) { }
0 0 elsif ($cnt2 > 0 and $cnt2 % 1000 == 0) { }
917 0 0 if ($cntCharLevel > 1) { }
931 0 0 if ($lcs > $bestLcs)
941 0 0 if ($cntGoodLength == 0) { }
944 0 0 if ($verbose > 0)
948 0 0 if ($cntCharLevel == 1) { }
954 0 0 if ($verbose > 2)
970 0 0 if ($$change[0] eq '-') { }
982 0 0 if ($numDel == 0) { }
1003 0 0 if ($verbose > 2)
1017 0 0 if ($$change[0] eq '-') { }
1028 0 0 if ($numDel == 0) { }
1046 0 0 if ($verbose > 0)
1070 1 1 unless (ref $location)
1081 0 2 if ($numLimits == 0 or $numLimits > 2) { }
1 1 elsif ($numLimits == 1) { }
1088 0 2 if (not $limits[0] =~ /\d+/ or $limits[0] == 0) { }
1093 1 1 if (not $limits[1] =~ /\d+/ or $limits[1] == 0) { }
1107 0 1 if ($$refToLocation{'source'})
1109 0 0 if ($sourceFileName =~ /^(EN|FR)\.sample.\d+$/)
1115 1 0 if (not $$refToLocation{'sampleNum'})
1127 0 2 if ($openMode eq '>')
1128 0 0 if ($format eq 'BLINKER')
1135 0 0 if ($oldFiles{$newFile} and $key ne 'sampleNum')
1143 0 0 if ($format eq 'BLINKER') { }
1146 0 0 if ($$location{'targetToSource'})
1149 0 0 if ($$location{'source'})
1152 0 0 if ($$location{'target'})
1158 0 2 if ($format eq 'GIZA') { }
1 1 elsif ($format eq 'NAACL' or $format eq 'TALP') { }
1 0 elsif ($format eq 'BLINKER') { }
1159 0 0 unless $FH{'sourceToTarget'} = 'IO::File'->new($openMode . $$location{'sourceToTarget'})
1160 0 0 if ($$location{'targetToSource'})
1161 0 0 unless $FH{'targetToSource'} = 'IO::File'->new($openMode . $$location{'targetToSource'})
1164 1 0 if ($$location{'source'})
1165 0 1 unless $FH{'source'} = 'IO::File'->new($openMode . $$location{'source'})
1167 1 0 if ($$location{'target'})
1168 0 1 unless $FH{'target'} = 'IO::File'->new($openMode . $$location{'target'})
1170 0 1 unless $FH{'sourceToTarget'} = 'IO::File'->new($openMode . $$location{'sourceToTarget'})
1171 0 1 if ($$location{'targetToSource'})
1172 0 0 unless $FH{'targetToSource'} = 'IO::File'->new($openMode . $$location{'targetToSource'})
1175 0 1 if ($$location{'source'})
1176 0 0 unless $FH{'source'} = 'IO::File'->new($openMode . $$location{'source'})
1178 0 1 if ($$location{'target'})
1179 0 0 unless $FH{'target'} = 'IO::File'->new($openMode . $$location{'target'})
1192 0 0 if ($type eq 'dir') { }
0 0 elsif ($type eq 'file') { }
1193 0 0 unless (-e $path and -d _)
1198 0 0 if ($path =~ m[/])
1200 0 0 unless (-e $dir)
1215 0 2 if ($$alSet{'format'} eq 'TALP') { }
0 2 elsif ($$alSet{'format'} eq 'GIZA') { }
1 1 elsif ($$alSet{'format'} eq 'NAACL') { }
1 0 elsif ($$alSet{'format'} eq 'BLINKER') { }
1217 0 0 if ($FH{'source'})
1220 0 0 if ($FH{'target'})
1223 0 0 if ($FH{'sourceToTarget'})
1226 0 0 if ($FH{'targetToSource'})
1235 0 0 if ($FH{'targetToSource'})
1243 0 0 if ($FH{'source'})
1246 0 0 if ($FH{'target'})
1253 0 0 if ($FH{'sourceToTarget'}->eof)
1257 0 0 if ($FH{'targetToSource'})
1262 0 0 if ($FH{'targetToSource'}->eof)
1269 0 1 if ($FH{'source'})
1274 0 1 if ($FH{'target'})
1287 0 2 if ($format eq 'GIZA') { }
1 1 elsif ($format eq 'NAACL' or $format eq 'TALP') { }
1 0 elsif ($format eq 'BLINKER') { }
1289 0 0 if ($$FH{'targetToSource'})
1293 1 0 if ($$FH{'source'})
1296 1 0 if ($$FH{'target'})
1299 1 0 if ($$FH{'sourceToTarget'})
1302 0 1 if ($$FH{'targetToSource'})
1306 0 1 if ($$FH{'source'})
1309 0 1 if ($$FH{'target'})
1325 0 22 if (not defined $alignMode or $alignMode =~ /^as.?is$/i) { }
0 22 elsif ($alignMode =~ /^null.?align$/i) { }
22 0 elsif ($alignMode =~ /^no.?null.?align$/i) { }
1334 0 22 if ($$alSet{'format'} eq 'TALP') { }
0 22 elsif ($$alSet{'format'} eq 'GIZA') { }
11 11 elsif ($$alSet{'format'} eq 'NAACL') { }
11 0 elsif ($$alSet{'format'} eq 'BLINKER') { }
1335 0 0 if ($$alSet{'lastSentPair'} eq 'eof') { }
1340 0 0 if ($theEnd) { }
1343 0 0 if ($$alFH{'source'})
1346 0 0 if ($$alFH{'target'})
1349 0 0 if ($$alFH{'sourceToTarget'})
1352 0 0 if ($$alFH{'targetToSource'})
1359 0 0 if ($$alSet{'lastSentPair'} eq 'eof') { }
1364 0 0 if ($theEnd) { }
1370 0 0 if ($$alFH{'targetToSource'})
1380 0 11 if ($$alSet{'lastSentPair'} eq 'eof') { }
1385 1 10 if ($theEnd) { }
1388 10 0 if ($$alFH{'source'})
1393 10 0 if ($$alFH{'target'})
1401 10 0 if ($num == $sentPairNum)
1410 0 10 if ($$alFH{'targetToSource'})
1414 0 0 if ($num == $sentPairNum)
1428 11 0 if ($$alSet{'lastSentPair'} eq 'eof') { }
1433 1 10 if ($theEnd) { }
1436 0 10 if ($$alFH{'source'})
1439 0 10 if ($$alFH{'target'})
1445 0 10 if ($$alSet{'location'}{'targetToSource'})
1454 0 20 if ($alignMode eq 'null-align') { }
20 0 elsif ($alignMode eq 'no-null-align') { }
1467 0 0 if ($$newLocation{'source'}) { }
1470 0 0 if ($$alSet{'firstSentPair'} != 1 or $$alSet{'format'} ne $newFormat)
1477 0 0 if ($$newLocation{'target'}) { }
1480 0 0 if ($$alSet{'firstSentPair'} != 1 or $$alSet{'format'} ne $newFormat)
1488 0 0 if ($newFormat eq 'BLINKER') { }
0 0 elsif (exists $$alSet{'location'}{'sampleNum'}) { }
1501 0 0 if (not defined $newFormat) { }
1513 0 0 if (defined $AlignmentSub)
1515 0 0 if (ref $AlignmentSub eq 'ARRAY') { }
1537 0 0 if (not defined $newFormat) { }
1556 0 0 if (@{$$clusters[$c]{'source'};} > 1 or @{$$clusters[$c]{'target'};} > 1)
1560 0 0 if ($clone->isIn('sourceAl', $j, $k))
1593 0 149 if (scalar @components < 3)
1601 0 0 if (scalar @components == 3 or scalar @components == 4 and $components[3] =~ /^[\d\.]+$/ || $components[3] eq 'S' or scalar @components == 5 and $components[3] eq 'S' || $components[4] eq 'S')
1607 0 0 if (scalar @components == 4 and $components[3] eq 'P' or scalar @components == 5 and $components[3] eq 'P' || $components[4] eq 'P')