Kelime frekanslarını görselleştirme
Artık durak kelimelerle ve durak kelimeler olmadan en sık geçen kelimeleri hesapladığına göre, farkları görselleştirme zamanı. Bu egzersizde, her iki durum için de çubuk grafikler çizmek üzere matplotlib kullanacaksın.
Aşağıdaki listeler senin için önceden yüklendi: top_words_without_stopwords, top_counts_without_stopwords, top_words_with_stopwords, top_counts_with_stopwords.
Bu egzersiz
Python ile Natural Language Processing (NLP)
kursunun bir parçasıdırEgzersiz talimatları
- Durak kelimelerle birlikte en sık geçen ilk 10 kelime frekansını çizmek için
plt.bar()kullan. - Durak kelimeler olmadan en sık geçen ilk 10 kelime frekansını çizmek için
plt.bar()kullan.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
import matplotlib.pyplot as plt
# Plot the frequencies with stop words
plt.bar(____, ____)
plt.title("Top 10 word frequencies (with stop words)")
plt.xlabel("Words")
plt.ylabel("Frequency")
plt.show()
# Plot the frequencies without stop words
plt.figure()
plt.bar(____, ____)
plt.title("Top 10 word frequencies (without stop words)")
plt.xlabel("Words")
plt.ylabel("Frequency")
plt.show()