mirror of
https://github.com/explosion/spaCy.git
synced 2025-05-31 11:13:26 +03:00
Handle non-callable gold_tuples in parser begin_training
This commit is contained in:
parent
1f7229f40f
commit
18da89e04c
|
@ -837,6 +837,9 @@ cdef class Parser:
|
||||||
def begin_training(self, get_gold_tuples, pipeline=None, sgd=None, **cfg):
|
def begin_training(self, get_gold_tuples, pipeline=None, sgd=None, **cfg):
|
||||||
if 'model' in cfg:
|
if 'model' in cfg:
|
||||||
self.model = cfg['model']
|
self.model = cfg['model']
|
||||||
|
if not hasattr(get_gold_tuples, '__call__'):
|
||||||
|
gold_tuples = get_gold_tuples
|
||||||
|
get_gold_tuples = lambda: gold_tuples
|
||||||
cfg.setdefault('min_action_freq', 30)
|
cfg.setdefault('min_action_freq', 30)
|
||||||
actions = self.moves.get_actions(gold_parses=get_gold_tuples(),
|
actions = self.moves.get_actions(gold_parses=get_gold_tuples(),
|
||||||
min_freq=cfg.get('min_action_freq', 30))
|
min_freq=cfg.get('min_action_freq', 30))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user