mirror of https://github.com/explosion/spaCy.git
Fix over-run on parse_batch
This commit is contained in:
parent
7ee1827af0
commit
a1ba20e2b1
|
@ -315,11 +315,11 @@ cdef class Parser:
|
||||||
|
|
||||||
todo = [st for st in states if not st.is_final()]
|
todo = [st for st in states if not st.is_final()]
|
||||||
while todo:
|
while todo:
|
||||||
token_ids = self.get_token_ids(states)
|
token_ids = self.get_token_ids(todo)
|
||||||
vectors = state2vec(token_ids)
|
vectors = state2vec(token_ids)
|
||||||
scores = vec2scores(vectors)
|
scores = vec2scores(vectors)
|
||||||
self.transition_batch(states, scores)
|
self.transition_batch(todo, scores)
|
||||||
todo = [st for st in states if not st.is_final()]
|
todo = [st for st in todo if not st.is_final()]
|
||||||
return states
|
return states
|
||||||
|
|
||||||
def update(self, docs_tokvecs, golds, drop=0., sgd=None):
|
def update(self, docs_tokvecs, golds, drop=0., sgd=None):
|
||||||
|
@ -469,10 +469,10 @@ cdef class Parser:
|
||||||
self.model = dill.load(file_)
|
self.model = dill.load(file_)
|
||||||
|
|
||||||
def to_bytes(self):
|
def to_bytes(self):
|
||||||
pass
|
dill.dumps(self.model)
|
||||||
|
|
||||||
def from_bytes(self, data):
|
def from_bytes(self, data):
|
||||||
pass
|
self.model = dill.loads(data)
|
||||||
|
|
||||||
|
|
||||||
class ParserStateError(ValueError):
|
class ParserStateError(ValueError):
|
||||||
|
|
Loading…
Reference in New Issue