mirror of https://github.com/explosion/spaCy.git
Fix Stepwisestate'
This commit is contained in:
parent
0739ae7b76
commit
1a98e48b8e
|
@ -383,7 +383,7 @@ cdef class StepwiseState:
|
||||||
def __init__(self, Parser parser, Doc doc, GoldParse gold=None):
|
def __init__(self, Parser parser, Doc doc, GoldParse gold=None):
|
||||||
self.parser = parser
|
self.parser = parser
|
||||||
self.doc = doc
|
self.doc = doc
|
||||||
if gold:
|
if gold is not None:
|
||||||
self.gold = gold
|
self.gold = gold
|
||||||
else:
|
else:
|
||||||
self.gold = GoldParse(doc)
|
self.gold = GoldParse(doc)
|
||||||
|
@ -427,6 +427,8 @@ cdef class StepwiseState:
|
||||||
"""
|
"""
|
||||||
Find the action-costs for the current state.
|
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.parser.moves.set_costs(self.eg.c.is_valid, self.eg.c.costs,
|
||||||
self.stcls, self.gold)
|
self.stcls, self.gold)
|
||||||
costs = {}
|
costs = {}
|
||||||
|
|
Loading…
Reference in New Issue