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: for tag in gold.tags:
if tag is None: if tag is None:
correct[idx] = guesses[idx] correct[idx] = guesses[idx]
elif isinstance(tag, list): # Leave these latent for now.
correct[idx] = guesses[idx]
else: else:
correct[idx] = tag_index[tag] correct[idx] = tag_index[tag]
idx += 1 idx += 1

View File

@ -479,6 +479,10 @@ cdef class ArcEager(TransitionSystem):
if head is None or dep is None: if head is None or dep is None:
gold.c.heads[i] = i gold.c.heads[i] = i
gold.c.has_dep[i] = False 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: else:
if head > i: if head > i:
action = LEFT action = LEFT

View File

@ -111,7 +111,10 @@ cdef class BiluoPushDown(TransitionSystem):
if not self.has_gold(gold): if not self.has_gold(gold):
return None return None
for i in range(gold.length): 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 return gold
def get_beam_annot(self, Beam beam): def get_beam_annot(self, Beam beam):