Skip to content

Multi-Scorers #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ USAGE
perl scorer.pl <metric> <key> <response> [<document-id>]


<metric>: the metric desired to score the results. one of the following values:
<metric>: the metrics desired to score the results (separated by +). ones of the following values:

muc: MUCScorer (Vilain et al, 1995)
bcub: B-Cubed (Bagga and Baldwin, 1998)
Expand All @@ -57,7 +57,7 @@ USAGE
<key>: file with expected coreference chains in CoNLL-2011/2012 format

<response>: file with output of coreference system (CoNLL-2011/2012 format)

<document-id>: optional. The name of the document to score. If name is not
given, all the documents in the dataset will be scored. If given
name is "none" then all the documents are scored but only total
Expand Down
4 changes: 2 additions & 2 deletions lib/CorScorer.pm
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ print "version: " . $VERSION . " " . Cwd::realpath(__FILE__) . "\n";
# 1.02 Corrected BCUB bug. It fails when the key file does not have any mention

# global variables
my $VERBOSE = 2;
my $VERBOSE = 1;
my $HEAD_COLUMN = 8;
my $RESPONSE_COLUMN = -1;
my $KEY_COLUMN = -1;
Expand Down Expand Up @@ -369,7 +369,7 @@ sub IdentifMentions {

my $i = 0;
my @remove;

foreach my $mention (@$entity) {
if (defined($map{"$mention->[0],$mention->[1]"})) {
print "Repeated mention in the response: $mention->[0], $mention->[1] ",
Expand Down
18 changes: 11 additions & 7 deletions scorer.pl
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ BEGIN
print q|
use: scorer.pl <metric> <keys_file> <response_file> [name]

metric: the metric desired to score the results:
metric: the metrics desired to score the results (separated by +):
muc: MUCScorer (Vilain et al, 1995)
bcub: B-Cubed (Bagga and Baldwin, 1998)
ceafm: CEAF (Luo et al, 2005) using mention-based similarity
Expand All @@ -41,18 +41,22 @@ BEGIN
}

my $metric = shift(@ARGV);
if ($metric !~ /^(muc|bcub|ceafm|ceafe|blanc|all)/i) {
print "Invalid metric\n";
exit;
foreach my $m (split(/\+/,$metric)){
if ($m !~ /^(muc|bcub|ceafm|ceafe|blanc|all)/i) {
print "Invalid metric: ".$m."\n";
exit;
}
}

if ($metric eq 'all') {
if ( grep( /^all&/, split(/\+/,$metric)) ) {
foreach my $m ('muc', 'bcub', 'ceafm', 'ceafe', 'blanc') {
print "\nMETRIC $m:\n";
&CorScorer::Score($m, @ARGV);
}
}
else {
&CorScorer::Score($metric, @ARGV);
foreach my $m (split(/\+/,$metric)){
print "\nMETRIC $m:\n";
&CorScorer::Score($m, @ARGV);
}
}