mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-24 17:06:29 +03:00
Update config when adding label. Re #910
This commit is contained in:
parent
b94286de30
commit
2f63806ddb
|
@ -19,6 +19,9 @@ cdef class EntityRecognizer(Parser):
|
|||
def add_label(self, label):
|
||||
for action in self.moves.action_types:
|
||||
self.moves.add_action(action, label)
|
||||
if 'actions' in self.cfg:
|
||||
self.cfg['actions'].setdefault(action,
|
||||
{}).setdefault(label, True)
|
||||
if isinstance(label, basestring):
|
||||
label = self.vocab.strings[label]
|
||||
for attr, freqs in self.vocab.serializer_freqs:
|
||||
|
@ -37,6 +40,9 @@ cdef class BeamEntityRecognizer(BeamParser):
|
|||
def add_label(self, label):
|
||||
for action in self.moves.action_types:
|
||||
self.moves.add_action(action, label)
|
||||
if 'actions' in self.cfg:
|
||||
self.cfg['actions'].setdefault(action,
|
||||
{}).setdefault(label, True)
|
||||
if isinstance(label, basestring):
|
||||
label = self.vocab.strings[label]
|
||||
for attr, freqs in self.vocab.serializer_freqs:
|
||||
|
@ -54,6 +60,9 @@ cdef class DependencyParser(Parser):
|
|||
def add_label(self, label):
|
||||
for action in self.moves.action_types:
|
||||
self.moves.add_action(action, label)
|
||||
if 'actions' in self.cfg:
|
||||
self.cfg['actions'].setdefault(action,
|
||||
{}).setdefault(label, True)
|
||||
if isinstance(label, basestring):
|
||||
label = self.vocab.strings[label]
|
||||
for attr, freqs in self.vocab.serializer_freqs:
|
||||
|
@ -71,6 +80,9 @@ cdef class BeamDependencyParser(BeamParser):
|
|||
def add_label(self, label):
|
||||
for action in self.moves.action_types:
|
||||
self.moves.add_action(action, label)
|
||||
if 'actions' in self.cfg:
|
||||
self.cfg['actions'].setdefault(action,
|
||||
{}).setdefault(label, True)
|
||||
if isinstance(label, basestring):
|
||||
label = self.vocab.strings[label]
|
||||
for attr, freqs in self.vocab.serializer_freqs:
|
||||
|
|
Loading…
Reference in New Issue
Block a user