mirror of https://github.com/explosion/spaCy.git
Add position of invalid token to error message
This commit is contained in:
parent
11c4735ccf
commit
9e83513004
|
@ -558,7 +558,8 @@ cdef class Doc:
|
||||||
t.l_edge = self.length
|
t.l_edge = self.length
|
||||||
t.r_edge = self.length
|
t.r_edge = self.length
|
||||||
if t.lex.orth == 0:
|
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
|
t.spacy = has_space
|
||||||
self.length += 1
|
self.length += 1
|
||||||
return t.idx + t.lex.length + t.spacy
|
return t.idx + t.lex.length + t.spacy
|
||||||
|
|
Loading…
Reference in New Issue