Skip to content

Commit

Permalink
Fix Issue #536: oov_prob was 0 for OOV words.
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Oct 19, 2016
1 parent dfa752d commit d10c17f
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions spacy/vocab.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,17 @@ cdef class Vocab:
'''
@classmethod
def load(cls, path, lex_attr_getters=None, vectors=True, lemmatizer=True,
tag_map=True, serializer_freqs=True, **deprecated_kwargs):
tag_map=True, serializer_freqs=True, oov_prob=True, **deprecated_kwargs):
util.check_renamed_kwargs({'get_lex_attr': 'lex_attr_getters'}, deprecated_kwargs)
if tag_map is True and (path / 'vocab' / 'tag_map.json').exists():
with (path / 'vocab' / 'tag_map.json').open() as file_:
tag_map = json.load(file_)

if lex_attr_getters is not None \
and oov_prob is True \
and (path / 'vocab' / 'oov_prob').exists():
with (path / 'vocab' / 'oov_prob').open() as file_:
oov_prob = float(file_.read())
lex_attr_getters[PROB] = lambda text: oov_prob
if lemmatizer is True:
lemmatizer = Lemmatizer.load(path)
if serializer_freqs is True and (path / 'vocab' / 'serializer.json').exists():
Expand Down

0 comments on commit d10c17f

Please sign in to comment.