Improve error message if token text is empty string (see #2101)

This commit is contained in:
ines 2018-03-27 22:25:40 +02:00
parent 0c829e6605
commit 693971dd8f

View File

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