Handle list-valued GoldParse values

This commit is contained in:
Matthew Honnibal 2018-04-01 17:42:33 +02:00
parent 29b77fd0eb
commit 2d929ffc5d
3 changed files with 10 additions and 1 deletions

View File

@ -500,6 +500,8 @@ class Tagger(Pipe):
for tag in gold.tags:
if tag is None:
correct[idx] = guesses[idx]
elif isinstance(tag, list): # Leave these latent for now.
correct[idx] = guesses[idx]
else:
correct[idx] = tag_index[tag]
idx += 1

View File

@ -479,6 +479,10 @@ cdef class ArcEager(TransitionSystem):
if head is None or dep is None:
gold.c.heads[i] = i
gold.c.has_dep[i] = False
elif isinstance(head, list):
# TODO: This is where the fused token stuff will happen
gold.c.heads[i] = i
gold.c.has_dep[i] = False
else:
if head > i:
action = LEFT

View File

@ -111,7 +111,10 @@ cdef class BiluoPushDown(TransitionSystem):
if not self.has_gold(gold):
return None
for i in range(gold.length):
gold.c.ner[i] = self.lookup_transition(gold.ner[i])
if isinstance(gold.ner[i], list):
gold.c.ner[i] = self.lookup_transition(None)
else:
gold.c.ner[i] = self.lookup_transition(gold.ner[i])
return gold
def get_beam_annot(self, Beam beam):