我们可以使用python-TextBlob中的SVM分类器对文本进行分类吗?

时间:2015-03-17 05:33:39

标签: python svm text-classification textblob

>>> train = [
   ('I love this sandwich.', 'pos'),
   ('this is an amazing place!', 'pos'),
   ('I feel very good about these beers.', 'pos'),
   ('this is my best work.', 'pos'),
   ("what an awesome view", 'pos'),
   ('I do not like this restaurant', 'neg'),
   ('I am tired of this stuff.', 'neg'),
   ("I can't deal with this", 'neg'),
   ('he is my sworn enemy!', 'neg'),
   ('my boss is horrible.', 'neg')
   ]
>>> test = [
    ('the beer was good.', 'pos'),
    ('I do not enjoy my job', 'neg'),
    ("I ain't feeling dandy today.", 'neg'),
    ("I feel amazing!", 'pos'),
    ('Gary is a friend of mine.', 'pos'),
    ("I can't believe I'm doing this.", 'neg')
    ]
>>> from textblob.classifiers import NaiveBayesClassifier
>>> cl = NaiveBayesClassifier(train)
>>> cl.classify("This is an amazing library!")
'pos'

上面的代码用于使用NaiveBayesClassifier使用Python对文本进行分类。同样,我使用了MaxEntClassifier,DecisionTreeClassifier。现在我想知道除了我提到的用于在python中进行分类的那些之外还有其他的classife。请让我知道!!!

0 个答案:

没有答案
相关问题