mirror of https://github.com/explosion/spaCy.git
Fix handling of unknown tags in tagger update
This commit is contained in:
parent
69c900f003
commit
3aabf621a3
|
@ -505,8 +505,10 @@ 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]
|
||||||
else:
|
elif tag in tag_index:
|
||||||
correct[idx] = tag_index[tag]
|
correct[idx] = tag_index[tag]
|
||||||
|
else:
|
||||||
|
correct[idx] = len(tag_index)+1
|
||||||
idx += 1
|
idx += 1
|
||||||
correct = self.model.ops.xp.array(correct, dtype='i')
|
correct = self.model.ops.xp.array(correct, dtype='i')
|
||||||
d_scores = scores - to_categorical(correct, nb_classes=scores.shape[1])
|
d_scores = scores - to_categorical(correct, nb_classes=scores.shape[1])
|
||||||
|
|
Loading…
Reference in New Issue