Fix handling of tuple-valued tags in Tagger

This commit is contained in:
Matthew Honnibal 2018-04-03 01:55:06 +02:00
parent 9c5c940441
commit 6d42e0ad8e

View File

@ -503,6 +503,8 @@ class Tagger(Pipe):
elif isinstance(tag, list): # Leave these latent for now. elif isinstance(tag, list): # Leave these latent for now.
correct[idx] = guesses[idx] correct[idx] = guesses[idx]
else: else:
if isinstance(tag, tuple):
tag = tag[0]
correct[idx] = tag_index[tag] correct[idx] = tag_index[tag]
idx += 1 idx += 1
correct = self.model.ops.xp.array(correct, dtype='i') correct = self.model.ops.xp.array(correct, dtype='i')