擅长:python、mysql、java
<p>如果您检查<code>twitter_samples.fileids()</code>,您将看到有单独的正反文件:</p>
<pre><code>>>> twitter_samples.fileids()
['negative_tweets.json', 'positive_tweets.json', 'tweets.20150430-223406.json']
</code></pre>
<p>因此,要将tweets分类为肯定或否定,只需选择相应的文件。这不是<code>nltk</code>处理分类语料库的常用方法,但是你已经有了它。在</p>
^{pr2}$
<p>这将得到10000条tweets的数据集。第三个文件包含另外20000个,显然没有分类。在</p>