* Start scoring tokens

This commit is contained in:
Matthew Honnibal 2015-06-28 06:21:38 +02:00
parent 4944d3ba20
commit 0c4b5a2bb0

View File

@ -46,7 +46,7 @@ class Scorer(object):
@property @property
def token_acc(self): def token_acc(self):
return self.tokens.fscore * 100 return self.tokens.precision * 100
@property @property
def uas(self): def uas(self):
@ -85,8 +85,10 @@ class Scorer(object):
continue continue
gold_i = gold.cand_to_gold[token.i] gold_i = gold.cand_to_gold[token.i]
if gold_i is None: if gold_i is None:
self.tags.fp += 1 if token.dep_.lower() not in ('p', 'punct'):
self.tokens.fp += 1
else: else:
self.tokens.tp += 1
cand_tags.add((gold_i, token.tag_)) cand_tags.add((gold_i, token.tag_))
if token.dep_.lower() not in ('p', 'punct') and token.orth_.strip(): if token.dep_.lower() not in ('p', 'punct') and token.orth_.strip():
gold_head = gold.cand_to_gold[token.head.i] gold_head = gold.cand_to_gold[token.head.i]