Fix Stepwisestate'

This commit is contained in:
Matthew Honnibal 2017-04-15 13:35:01 +02:00
parent 0739ae7b76
commit 1a98e48b8e
1 changed files with 3 additions and 1 deletions

View File

@ -383,7 +383,7 @@ cdef class StepwiseState:
def __init__(self, Parser parser, Doc doc, GoldParse gold=None):
self.parser = parser
self.doc = doc
if gold:
if gold is not None:
self.gold = gold
else:
self.gold = GoldParse(doc)
@ -427,6 +427,8 @@ cdef class StepwiseState:
"""
Find the action-costs for the current state.
"""
if not self.gold:
raise ValueError("Can't set costs: No GoldParse provided")
self.parser.moves.set_costs(self.eg.c.is_valid, self.eg.c.costs,
self.stcls, self.gold)
costs = {}