Pythonで学ぶSentiment Analysis
Violeta Misheva
Data Scientist
I am happy, not sad.
I am sad, not happy.
Unigram: 単語1個のトークン
Bigram: 2語の組
Trigram: 3語の組
n-gram: n語の連続トークン
The weather today is wonderful.
Unigram: { The, weather, today, is, wonderful }
Bigram: {The weather, weather today, today is, is wonderful}
Trigram: {The weather today, weather today is, today is wonderful}
from sklearn.feature_extraction.text import CountVectorizer
vect = CountVectorizer(ngram_range=(min_n, max_n))
# ユニグラムのみ
ngram_range=(1, 1)
# ユニグラム+バイグラム
ngram_range=(1, 2)
CountVectorizer(max_features, max_df, min_df)
Pythonで学ぶSentiment Analysis