Từ dừng

Phân tích cảm xúc với Python

Violeta Misheva

Data Scientist

Từ dừng là gì và tìm chúng thế nào?

Từ dừng: các từ xuất hiện quá thường xuyên và không mang nhiều thông tin

  • Có danh sách từ dừng cho hầu hết ngôn ngữ

      {'the', 'a', 'an', 'and', 'but', 'for', 'on', 'in', 'at' ...}
    
  • Phụ thuộc ngữ cảnh

      {'movie', 'movies', 'film', 'films', 'cinema'}
    
Phân tích cảm xúc với Python

Từ dừng với đám mây từ

  • Đám mây từ, không loại bỏ từ dừng Đám mây từ không loại bỏ từ dừng
  • Đám mây từ sau khi loại bỏ từ dừng Đám mây từ đã loại bỏ từ dừng
Phân tích cảm xúc với Python

Loại bỏ từ dừng khỏi đám mây từ

# Import libraries
from wordcloud import WordCloud, STOPWORDS
import matplotlib.pyplot as plt
# Define the stopwords list
my_stopwords = set(STOPWORDS)
my_stopwords.update(["movie", "movies", "film", "films", "watch", "br"])
# Generate and show the word cloud
my_cloud = WordCloud(background_color='white', stopwords=my_stopwords).generate(name_string)
plt.imshow(my_cloud, interpolation='bilinear')
Phân tích cảm xúc với Python

Từ dừng với BOW

from sklearn.feature_extraction.text import CountVectorizer, ENGLISH_STOP_WORDS
# Define the set of stop words
my_stop_words = ENGLISH_STOP_WORDS.union(['film', 'movie', 'cinema', 'theatre'])
vect = CountVectorizer(stop_words=my_stop_words) 
vect.fit(movies.review)
X = vect.transform(movies.review)
Phân tích cảm xúc với Python

Ayo berlatih!

Phân tích cảm xúc với Python

Preparing Video For Download...