Skip to content

Commit

Permalink
Merge b100403 into c4140b4
Browse files Browse the repository at this point in the history
  • Loading branch information
rybesh committed Mar 26, 2015
2 parents c4140b4 + b100403 commit d09e756
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
6 changes: 3 additions & 3 deletions segeval/similarity/__init__.py
Expand Up @@ -113,11 +113,11 @@ def __boundary_confusion_matrix__(*args, **kwargs):
hyp, ref = None, None
boundary_type, side = addition
if side == 'a':
hyp = None
ref = boundary_type
else: # side == 'b'
hyp = boundary_type
ref = None
else: # side == 'b'
hyp = None
ref = boundary_type
assert side == 'a' or side == 'b'
matrix[hyp][ref] += 1
return matrix
Expand Down
15 changes: 7 additions & 8 deletions segeval/similarity/test.py
Expand Up @@ -23,18 +23,17 @@ def test_boundary_confusion_matrix(self):
Test confusion matrix.
'''
cm = boundary_confusion_matrix(
[set([]), set([2]), set([]), set([]), set([1]), set([1]),
set([1]), set([1])],
[set([1]), set([1]), set([]), set([1]), set([]), set([1]),
set([]), set([])],
# A-b S M T --------T M A-a A-a
[set([ ]), set([2]), set([ ]), set([ ]), set([1]), set([1]), set([1]), set([1])],
[set([1]), set([1]), set([ ]), set([1]), set([ ]), set([1]), set([ ]), set([ ])],
boundary_format=BoundaryFormat.sets)
self.assertEqual(cm[None][1], 2)
self.assertEqual(cm[1][None], 1)
self.assertEqual(cm[None][1], 1) # A-b
self.assertEqual(cm[1][None], 2) # A-a
self.assertEqual(cm[None][2], 0)
self.assertEqual(cm[2][None], 0)
self.assertEqual(cm[2][1], 1)
self.assertEqual(cm[2][1], 1) # S
self.assertEqual(cm[1][2], 0)
self.assertEqual(cm[1][1], Decimal('1.5'))
self.assertEqual(cm[1][1], Decimal('1.5')) # M + T
self.assertEqual(cm[2][2], 0)

def test_boundary_statistics(self):
Expand Down

0 comments on commit d09e756

Please sign in to comment.