
3.2
前処理:共通する単語の出現回数を類似度として計測する
53
ストップワードとして単語を思いつくのであれば、そのリストを
stop_words
に指定することがで
きます。ここでは、
english
と指定することで、318 個の単語をストップワードとして登録できま
す。どのような単語がストップワードとして登録されるかを見るためには、
get_stop_words()
を用
います。
>>>
sorted(vectorizer.get_stop_words())[0:20]
['a', 'about', 'above', 'across', 'after', 'afterwards', 'again', 'against',
'all', 'almost', 'alone', 'along', 'already', 'also', 'although', 'always', 'am',
'among', 'amongst', 'amoungst']
このストップワードを用いると、単語リストは全部で7つ減ります。
[u'actually', u'capabilities', u'contains', u'data', u'databases', u'images',
u'imaging', u'interesting', u'learning', u'machine', u'permanently', u'post',
u'provide', u'safe', u'storage', u'store',u'stuff', ...