mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 01:46:28 +03:00
Allow gold.sent_starts to be set from Python
This commit is contained in:
parent
a8e70a4187
commit
bf19f22340
|
@ -545,9 +545,20 @@ cdef class GoldParse:
|
|||
"""
|
||||
return not nonproj.is_nonproj_tree(self.heads)
|
||||
|
||||
@property
|
||||
def sent_starts(self):
|
||||
return [self.c.sent_start[i] for i in range(self.length)]
|
||||
property sent_starts:
|
||||
def __get__(self):
|
||||
return [self.c.sent_start[i] for i in range(self.length)]
|
||||
|
||||
def __set__(self, sent_starts):
|
||||
for gold_i, is_sent_start in enumerate(sent_starts):
|
||||
i = self.gold_to_cand[gold_i]
|
||||
if i is not None:
|
||||
if is_sent_start in (1, True):
|
||||
self.c.sent_start[i] = 1
|
||||
elif is_sent_start in (-1, False):
|
||||
self.c.sent_start[i] = -1
|
||||
else:
|
||||
self.c.sent_start[i] = 0
|
||||
|
||||
|
||||
def biluo_tags_from_offsets(doc, entities, missing='O'):
|
||||
|
|
Loading…
Reference in New Issue
Block a user