Commit 8b3669e0 by Steven Bird

conditional import of optional libraries, so that nltk can still be installed without them

parent dac4274b
......@@ -12,10 +12,13 @@ import pickle
from os import remove
from copy import deepcopy
from operator import itemgetter
from scipy import sparse
from numpy import array
from sklearn.datasets import load_svmlight_file
from sklearn import svm
try:
from scipy import sparse
from numpy import array
from sklearn.datasets import load_svmlight_file
from sklearn import svm
except ImportError:
pass
from nltk.parse import ParserI, DependencyGraph, DependencyEvaluator
......@@ -762,6 +765,7 @@ def demo():
Note that result is very poor because of only one training example.
"""
if __name__ == '__main__':
import doctest
doctest.testmod(optionflags=doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS)
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