Add position of invalid token to error message

This commit is contained in:
ines 2018-03-27 23:56:59 +02:00
parent 11c4735ccf
commit 9e83513004

View File

@ -558,7 +558,8 @@ cdef class Doc:
t.l_edge = self.length
t.r_edge = self.length
if t.lex.orth == 0:
raise ValueError("Invalid token: empty string ('')")
raise ValueError("Invalid token: empty string ('') at position {}"
.format(self.length))
t.spacy = has_space
self.length += 1
return t.idx + t.lex.length + t.spacy