* Avoid NER scoring for sentences with some missing NER values.

This commit is contained in:
Matthew Honnibal 2015-05-28 22:39:08 +02:00
parent f42dc1f7d8
commit 6b2e5c4b8a
1 changed files with 10 additions and 10 deletions

View File

@ -95,6 +95,7 @@ class Scorer(object):
self.tags.fp += 1 self.tags.fp += 1
else: else:
cand_tags.add((gold_i, token.tag_)) cand_tags.add((gold_i, token.tag_))
if '-' not in [token[-1] for token in gold.orig_annot]:
cand_ents = set() cand_ents = set()
for ent in tokens.ents: for ent in tokens.ents:
first = gold.cand_to_gold[ent.start] first = gold.cand_to_gold[ent.start]
@ -103,7 +104,6 @@ class Scorer(object):
self.ner.fp += 1 self.ner.fp += 1
else: else:
cand_ents.add((ent.label_, first, last)) cand_ents.add((ent.label_, first, last))
self.ner.score_set(cand_ents, gold_ents) self.ner.score_set(cand_ents, gold_ents)
self.tags.score_set(cand_tags, gold_tags) self.tags.score_set(cand_tags, gold_tags)
self.labelled.score_set(cand_deps, gold_deps) self.labelled.score_set(cand_deps, gold_deps)