Fix over-run on parse_batch

This commit is contained in:
Matthew Honnibal 2017-05-19 18:57:30 -05:00
parent 7ee1827af0
commit a1ba20e2b1
1 changed files with 5 additions and 5 deletions

View File

@ -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):