mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
Merge branch 'develop' into feature/lemmatizer
This commit is contained in:
commit
e4d8f86d7f
|
@ -213,8 +213,7 @@ class ParserModel(Model):
|
|||
self._layers[-1]._layers[-1] = larger
|
||||
|
||||
def begin_training(self, X, y=None):
|
||||
for layer in self._layers:
|
||||
layer.begin_training(X, y=y)
|
||||
self.lower.begin_training(X, y=y)
|
||||
|
||||
@property
|
||||
def tok2vec(self):
|
||||
|
|
|
@ -525,8 +525,7 @@ cdef class Parser:
|
|||
else:
|
||||
if sgd is None:
|
||||
sgd = self.create_optimizer()
|
||||
self.model.begin_training(
|
||||
self.model.ops.allocate((5, cfg['token_vector_width'])))
|
||||
self.model.begin_training([])
|
||||
self.cfg.update(cfg)
|
||||
return sgd
|
||||
|
||||
|
|
|
@ -994,12 +994,12 @@ cdef int set_children_from_heads(TokenC* tokens, int length) except -1:
|
|||
tokens[i].l_edge = i
|
||||
tokens[i].r_edge = i
|
||||
# Twice, for non-projectivity
|
||||
for _ in range(2):
|
||||
for loop_count in range(2):
|
||||
# Set left edges
|
||||
for i in range(length):
|
||||
child = &tokens[i]
|
||||
head = &tokens[i + child.head]
|
||||
if child < head:
|
||||
if child < head and loop_count == 0:
|
||||
head.l_kids += 1
|
||||
if child.l_edge < head.l_edge:
|
||||
head.l_edge = child.l_edge
|
||||
|
@ -1009,7 +1009,7 @@ cdef int set_children_from_heads(TokenC* tokens, int length) except -1:
|
|||
for i in range(length-1, -1, -1):
|
||||
child = &tokens[i]
|
||||
head = &tokens[i + child.head]
|
||||
if child > head:
|
||||
if child > head and loop_count == 0:
|
||||
head.r_kids += 1
|
||||
if child.r_edge > head.r_edge:
|
||||
head.r_edge = child.r_edge
|
||||
|
|
Loading…
Reference in New Issue
Block a user