शुरू करेंमुफ़्त में शुरू करें

शब्द आवृत्तियों का विज़ुअलाइज़ेशन

अब जब आप बिना स्टॉप वर्ड्स और स्टॉप वर्ड्स के साथ सबसे अधिक आने वाले शब्द निकाल चुके हैं, तो अब उन्हें विज़ुअलाइज़ करने का समय है। इस अभ्यास में, आप matplotlib का उपयोग करके दोनों मामलों के लिए बार चार्ट प्लॉट करेंगे.

निम्न सूचियाँ आपके लिए पहले से लोड की गई हैं: top_words_without_stopwords, top_counts_without_stopwords, top_words_with_stopwords, top_counts_with_stopwords.

यह अभ्यास पाठ्यक्रम का हिस्सा है

Python में Natural Language Processing (NLP)

पाठ्यक्रम देखें

अभ्यास निर्देश

  • स्टॉप वर्ड्स के साथ शीर्ष 10 शब्द आवृत्तियों को प्लॉट करने के लिए plt.bar() का उपयोग करें.
  • स्टॉप वर्ड्स के बिना शीर्ष 10 शब्द आवृत्तियों को प्लॉट करने के लिए plt.bar() का उपयोग करें.

इंटरैक्टिव व्यावहारिक अभ्यास

इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।

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()
कोड संपादित करें और चलाएँ