mirror of https://github.com/explosion/spaCy.git
* Add get() function in spacy/syntax/Config
This commit is contained in:
parent
ac422492cf
commit
731e5f1e46
|
@ -6,6 +6,9 @@ class Config(object):
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
|
|
||||||
|
def get(self, attr, default=None):
|
||||||
|
return self.__dict__.get(attr, default)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def write(cls, model_dir, name, **kwargs):
|
def write(cls, model_dir, name, **kwargs):
|
||||||
open(path.join(model_dir, '%s.json' % name), 'w').write(json.dumps(kwargs))
|
open(path.join(model_dir, '%s.json' % name), 'w').write(json.dumps(kwargs))
|
||||||
|
|
Loading…
Reference in New Issue