擅长:python、mysql、java
<p>我只是在学NLTK,如果我错了请纠正我。这使用的是NLTK的python3分支,这可能不兼容。在</p>
<p>对<code>NaiveBayesClassifier</code>实例有一个<code>update()</code>方法,它似乎添加到训练数据中:</p>
<pre><code>from textblob.classifiers import NaiveBayesClassifier
train = [
('training test totally tubular', 't'),
]
cl = NaiveBayesClassifier(train)
cl.update([('super speeding special sport', 's')])
print('t', cl.classify('tubular test'))
print('s', cl.classify('super special'))
</code></pre>
<p>打印出来:</p>
^{pr2}$