当前位置: 首页>>代码示例>>Python>>正文


Python NaiveBayesClassifier.classify方法代码示例

本文整理汇总了Python中nltk.classify.NaiveBayesClassifier.classify方法的典型用法代码示例。如果您正苦于以下问题:Python NaiveBayesClassifier.classify方法的具体用法?Python NaiveBayesClassifier.classify怎么用?Python NaiveBayesClassifier.classify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nltk.classify.NaiveBayesClassifier的用法示例。


在下文中一共展示了NaiveBayesClassifier.classify方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: classifyTest

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
 def classifyTest(self,test, classifier, feature_extractor):
     testClassifies = []
     for doc,lbl in test:
         tmpLbl = classifier.classify(feature_extractor(movie_reviews.words(fileids=[doc])))
         x = (doc,tmpLbl)
         testClassifies.append(x)
     return testClassifies
开发者ID:atiassa,项目名称:recommend-2011,代码行数:9,代码来源:q2_1.py

示例2: hasNegativeSent

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
def hasNegativeSent(text):
    #take in raw text, not tokens
    return nb_classifier.classify(word_features(text))
开发者ID:SindhujaJeyabal,项目名称:TownHall,代码行数:5,代码来源:checkText.py

示例3: test

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
	def test(self):
		testArr= self.matched[100:]
		random.shuffle(testArr)
		for item in testArr:
			classified = NaiveBayesClassifier.classify(self.model,item)	
开发者ID:bonethrown,项目名称:Machine-learning-toolkit-,代码行数:7,代码来源:mapperSet.py

示例4: batchClassify

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
	def batchClassify(self, model):
		for item in self.unmatched:
			classified = NaiveBayesClassifier.classify(model, item.featurize())	
开发者ID:bonethrown,项目名称:Machine-learning-toolkit-,代码行数:5,代码来源:mapperSet.py

示例5: classify

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
	def classify(self, model, item):
		_name = self.convertItem(item)
		tokens = _name.getNameDes()
		classified = NaiveBayesClassifier.classify(model, _name.input_featurize(tokens))	
		return classified
开发者ID:bonethrown,项目名称:Machine-learning-toolkit-,代码行数:7,代码来源:mapperSet.py

示例6: nameobj_classify

# 需要导入模块: from nltk.classify import NaiveBayesClassifier [as 别名]
# 或者: from nltk.classify.NaiveBayesClassifier import classify [as 别名]
	def nameobj_classify(self, model, _name):
		tokens = _name.name + name.brand
		classified = NaiveBayesClassifier.classify(model, _name.input_featurize(tokens))	
		return classified
开发者ID:bonethrown,项目名称:Machine-learning-toolkit-,代码行数:6,代码来源:mapperSet.py


注:本文中的nltk.classify.NaiveBayesClassifier.classify方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。