Made lexicon unpickling more robust; on error it regenerates it.

parent c28ca950
...@@ -102,7 +102,12 @@ def try_to_unpickle_lexicon(): ...@@ -102,7 +102,12 @@ def try_to_unpickle_lexicon():
if notify_lexicon_unpickling: if notify_lexicon_unpickling:
t0 = time() t0 = time()
print("Unpickling lexicon...") print("Unpickling lexicon...")
lexicon = pickle.load(f) try:
lexicon = pickle.load(f)
except Exception, e:
print "WARNING: Exception while loading lexicon pickle, regenerating"
print e
lexicon = None
f.close() f.close()
if notify_lexicon_unpickling: if notify_lexicon_unpickling:
t1 = time() t1 = time()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment