mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
Improve error message if token text is empty string (see #2101)
This commit is contained in:
parent
0c829e6605
commit
693971dd8f
|
@ -557,7 +557,8 @@ cdef class Doc:
|
||||||
t.idx = (t-1).idx + (t-1).lex.length + (t-1).spacy
|
t.idx = (t-1).idx + (t-1).lex.length + (t-1).spacy
|
||||||
t.l_edge = self.length
|
t.l_edge = self.length
|
||||||
t.r_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
|
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
Block a user