Return None from parser if there are no annotations

This commit is contained in:
Matthew Honnibal 2017-05-26 14:02:59 -05:00
parent 8af3100143
commit 3d22fcaf0b
1 changed files with 2 additions and 0 deletions

View File

@ -432,6 +432,8 @@ cdef class Parser:
0.0) 0.0)
todo = [(s, g) for (s, g) in zip(states, golds) todo = [(s, g) for (s, g) in zip(states, golds)
if not s.is_final() and g is not None] if not s.is_final() and g is not None]
if not todo:
return None
backprops = [] backprops = []
d_tokvecs = state2vec.ops.allocate(tokvecs.shape) d_tokvecs = state2vec.ops.allocate(tokvecs.shape)