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

प्रोडक्ट रिव्यूज़ का फ़्रीक्वेंसी विश्लेषण

अब आपके पास TechZone के प्रोडक्ट रिव्यूज़ का एक बड़ा डेटासेट है। पहले की तरह, आपने रिव्यूज़ को प्रीप्रोसेस करके BoW निरूपण X में बदल दिया है। आपका कार्य अब शब्दों की फ़्रीक्वेंसी का विश्लेषण करना और डेटासेट में सबसे आम terms पहचानना है.

विश्लेषण में मदद के लिए get_top_ten() नाम का एक हेल्पर फंक्शन दिया गया है। यह शब्दों की सूची और उनके संबंधित काउंट लेता है और 10 सबसे अधिक बार आने वाले शब्द और उनके काउंट लौटाता है।

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

Python में Natural Language Processing (NLP)

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

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

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

def preprocess(text):
    text = text.lower()
    tokens = word_tokenize(text)
    tokens = [word for word in tokens if word not in string.punctuation]
    return " ".join(tokens)
  
cleaned_reviews = [preprocess(review) for review in product_reviews]
X = vectorizer.fit_transform(cleaned_reviews)

# Get word counts
word_counts = np.____(X.____, axis=0)
# Get words
words = vectorizer.____

top_words_with_stopwords, top_counts_with_stopwords = get_top_ten(words, word_counts)
print(top_words_with_stopwords, top_counts_with_stopwords)
कोड संपादित करें और चलाएँ