Аналіз тональності в Python
Violeta Misheva
Data Scientist
I am happy, not sad.
I am sad, not happy.
Уніграми: окремі токени
Біграми: пари токенів
Тріграми: трійки токенів
n-грамі: послідовність із n токенів
The weather today is wonderful.
Уніграми: { The, weather, today, is, wonderful }
Біграми: {The weather, weather today, today is, is wonderful}
Тріграми: {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