1. Jacob Perkins
  2. nltk-trainer

Commits

Jacob Perkins  committed 15bd2fb

SvmClassifier theoretically works

  • Participants
  • Parent commits c38e8d8
  • Branches default

Comments (0)

Files changed (1)

File nltk_trainer/classification/args.py

View file
  • Ignore whitespace
 verbose_classifiers = set(['RandomForestClassifier', 'SVC'])
 
 try:
+	import svmlight # do this first since svm module makes ugly errors
+	from nltk.classify.svm import SvmClassifier
+	classifier_choices.append('Svm')
+except:
+	pass
+
+try:
 	from nltk.classify import scikitlearn
 	from sklearn.feature_extraction.text import TfidfTransformer
 	from sklearn.pipeline import Pipeline
 			classifier_train_kwargs['verbose'] = args.trace
 		elif algo == 'NaiveBayes':
 			classifier_train = NaiveBayesClassifier.train
+		elif algo == 'Svm':
+			classifier_train = SvmClassifier.train
 		elif algo.startswith('sklearn.'):
 			# TODO: support many options for building an estimator pipeline
 			pipe = [('classifier', make_sklearn_classifier(algo, args))]