From eeaea25f0caada871aeb8f5ece5d00f7c50f6a89 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 26 Jul 2015 16:36:38 +0200 Subject: [PATCH] * Check oov_prob file is present --- spacy/en/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spacy/en/__init__.py b/spacy/en/__init__.py index d368aa05d..4eccb1d37 100644 --- a/spacy/en/__init__.py +++ b/spacy/en/__init__.py @@ -80,11 +80,16 @@ class English(object): ): self.data_dir = data_dir + + if path.exists(path.join(data_dir, 'vocab', 'oov_prob')): + oov_prob = float(open(path.join(data_dir, 'vocab', 'oov_prob')).read()) + else: + oov_prob = None self.vocab = Vocab(data_dir=path.join(data_dir, 'vocab') if data_dir else None, get_lex_props=get_lex_props, load_vectors=load_vectors, pos_tags=POS_TAGS, - oov_prob=float(open(path.join(data_dir, 'vocab', 'oov_prob')).read())) + oov_prob=oov_prob) if Tagger is True: Tagger = EnPosTagger if Parser is True: