Am I doing anything wrong here - when trying to visualize the wordcloud with matplotlib?

92 Views Asked by At

This is my first project on word cloud - can any please help to solve the issue ? I'm getting an error - Type Error: 'module' object is not callable. Here is the below complete code for your reference.

# necessary library import
from wordcloud import wordcloud
import matplotlib.pyplot as plt
%matplotlib inline
import pandas as pd
import numpy as np
import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
stop_words = set(stopwords.words('english'))

#my text
data = '''Data science is the field of study that combines domain expertise, programming skills, and knowledge of mathematics and statistics to extract meaningful insights from data. Data science practitioners apply machine learning algorithms to numbers, text, images, video, audio, and more to produce artificial intelligence (AI) systems to perform tasks that ordinarily require human intelligence. In turn, these systems generate insights which analysts and business users can translate into tangible business value.'''

#funtion for word tokenize and remove stopwords
def data_processing(data):
    data_tokens = word_tokenize(data)
    
    processed_words = [w for w in data_tokens if not w in stop_words]
    return " ".join(processed_words)

#function run 
data_processed = data_processing(data)

#wordcloud visualization
plt.figure(figsize=(10,10), facecolor = 'none')
wordcloud= wordcloud().generate(data)
plt.imshow(wordcloud)
plt.axis('off')
plt.show()

enter image description here

0

There are 0 best solutions below