1 朴素贝叶斯分类器(NLTK)
nltk.classify.naivebayes.NaiveBayesClassifier 继承于class nltk.classify.api.ClassifierI。
classify(featureset)[source]
返回:给定特征集的最合适标签。
返回类型:label
prob_classify(featureset)[source]
返回:给定特征集的标签上的概率分布。
返回类型:ProbDistI
参考:http://www.nltk.org/api/nltk.classify.html#nltk.classify.api.ClassifierI
2 正则表达式标记符
A RegexpTokenizer splits a string into substrings using a regular expression. For example, the following tokenizer forms tokens out of alphabetic sequences, money expressions, and any other non-whitespace sequences:
RegexpTokenizer使用正则表达式将字符串拆分为子字符串。 例如,以下标记生成器使用字母序列,货币表达式和任何其他非空白序列来形成标记: