mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 00:46:28 +03:00
Return True from doc.is_... when no ambiguity
* Make doc.is_sentenced return True if len(doc) < 2. * Make doc.is_nered return True if len(doc) == 0, for consistency. Closes #3934
This commit is contained in:
parent
465456edb9
commit
3d18600c05
|
@ -240,6 +240,8 @@ cdef class Doc:
|
|||
return True
|
||||
if self.is_parsed:
|
||||
return True
|
||||
if len(self) < 2:
|
||||
return True
|
||||
for i in range(1, self.length):
|
||||
if self.c[i].sent_start == -1 or self.c[i].sent_start == 1:
|
||||
return True
|
||||
|
@ -251,6 +253,8 @@ cdef class Doc:
|
|||
*any* of the tokens has a named entity tag set (even if the others are
|
||||
uknown values).
|
||||
"""
|
||||
if len(self) == 0:
|
||||
return True
|
||||
for i in range(self.length):
|
||||
if self.c[i].ent_iob != 0:
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue
Block a user