From 731e5f1e466b0622584344b08107ca6fd6c34c22 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 7 Jun 2015 19:09:15 +0200 Subject: [PATCH] * Add get() function in spacy/syntax/Config --- spacy/syntax/util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spacy/syntax/util.py b/spacy/syntax/util.py index 64b259b6b..87c1baab0 100644 --- a/spacy/syntax/util.py +++ b/spacy/syntax/util.py @@ -6,6 +6,9 @@ class Config(object): for key, value in kwargs.items(): setattr(self, key, value) + def get(self, attr, default=None): + return self.__dict__.get(attr, default) + @classmethod def write(cls, model_dir, name, **kwargs): open(path.join(model_dir, '%s.json' % name), 'w').write(json.dumps(kwargs))