Skip to content

Commit

Permalink
FIX In case of duplicates, use the max value (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnothman committed Jun 19, 2018
1 parent 264f6d4 commit eee26ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion doc/approximate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ columns:
* weight

For types not in this weight file, exact matches between gold type and system
type score 1, and otherwise score is 0.
type score 1, and otherwise score is 0. If multiple gold/system entries exist,
the maximum weight is used.

The following example scores 0.123 where the gold type is ``type1`` and the
system type is ``type2``.
Expand Down
4 changes: 3 additions & 1 deletion neleval/configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,9 @@ def __init__(self, path):
for l in f:
gold, sys, weight = l.split('\t')
weight = float(weight)
self.values[gold, sys] = weight
self.values[gold, sys] = max(weight,
self.values.get((gold, sys),
weight))

def __call__(self, gold_type, sys_type):
return self.values.get((gold_type, sys_type),
Expand Down

0 comments on commit eee26ec

Please sign in to comment.