Add GoldParse.resize_arrays method

This commit is contained in:
Matthew Honnibal 2018-04-01 22:10:53 +02:00
parent cb6988f2f4
commit fb9c3984b5

View File

@ -592,6 +592,16 @@ cdef class GoldParse:
"""
return self.length
def resize_arrays(self, int new_size):
# These are filled by the tagger/parser/entity recogniser
self.c.tags = <int*>self.mem.realloc(self.c.tags, new_size * sizeof(int))
self.c.heads = <int*>self.mem.realloc(self.c.heads, new_size * sizeof(int))
self.c.labels = <attr_t*>self.mem.realloc(self.c.labels, new_size * sizeof(attr_t))
self.c.has_dep = <int*>self.mem.realloc(self.c.has_dep, new_size * sizeof(int))
self.c.sent_start = <int*>self.mem.realloc(self.c.sent_start, new_size * sizeof(int))
self.c.ner = <Transition*>self.mem.realloc(self.c.ner, new_size * sizeof(Transition))
self.c.fused = <int*>self.mem.realloc(self.c.fused, new_size * sizeof(int))
@property
def is_projective(self):
"""Whether the provided syntactic annotations form a projective