Skip to content

Commit 1d87110

Browse files
the repeated mentions check was limited to within a single document
so extended it to be within an entire collection of documents being scored.
1 parent a0ae348 commit 1d87110

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/CorScorer.pm

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ my $KEY_COLUMN = -1;
8787
# F1 = 2 * Recall * Precision / (Recall + Precision)
8888
sub Score {
8989
my ($metric, $kFile, $rFile, $name) = @_;
90+
our $repeated_mentions = 0;
9091

9192
if (lc($metric) eq 'blanc') {
9293
return ScoreBLANC($kFile, $rFile, $name);
@@ -346,7 +347,7 @@ sub IdentifMentions {
346347
foreach my $entity (@$keys) {
347348
foreach my $mention (@$entity) {
348349
if (defined($id{"$mention->[0],$mention->[1]"})) {
349-
print "Repeated mention: $mention->[0], $mention->[1] ",
350+
print "Repeated mention in the key: $mention->[0], $mention->[1] ",
350351
$id{"$mention->[0],$mention->[1]"}, $idCount, "\n";
351352
}
352353
$id{"$mention->[0],$mention->[1]"} = $idCount;
@@ -356,24 +357,23 @@ sub IdentifMentions {
356357

357358
# correct identification: Exact bound limits
358359
my $exact = 0;
359-
my $repeats = 0;
360360
foreach my $entity (@$response) {
361361

362362
my $i = 0;
363363
my @remove;
364364

365365
foreach my $mention (@$entity) {
366366
if (defined($map{"$mention->[0],$mention->[1]"})) {
367-
print "Repeated mention: $mention->[0], $mention->[1] ",
367+
print "Repeated mention in the response: $mention->[0], $mention->[1] ",
368368
$map{"$mention->[0],$mention->[1]"},
369369
$id{"$mention->[0],$mention->[1]"},
370370
"\n";
371371
push(@remove, $i);
372-
$repeats++;
372+
$main::repeated_mentions++;
373373

374-
if ($repeats > 10)
374+
if ($main::repeated_mentions > 10)
375375
{
376-
print STDERR "Found too many repeats (> 10) in the response, so refusing to score. Please fix the output.\n";
376+
print STDERR "Found too many repeated mentions (> 10) in the response, so refusing to score. Please fix the output.\n";
377377
exit 1;
378378
}
379379

0 commit comments

Comments
 (0)