Commit 497e0a01 by Steven Bird

protect all numpy imports with a try-except block; so that NLTK can be imported…

protect all numpy imports with a try-except block; so that NLTK can be imported when numpy is not installed (i.e. missing numpy should only generate errors at runtime
parent 73906dcc
......@@ -70,7 +70,11 @@ which includes extensive demonstration code.
import re
import types
from numpy import zeros, ones, float32, float64, log2, hstack, array, argmax
try:
from numpy import zeros, ones, float32, float64, log2, hstack, array, argmax
except ImportError:
pass
from nltk.probability import (FreqDist, ConditionalFreqDist,
ConditionalProbDist, DictionaryProbDist,
......
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