Update app.py
Browse files
app.py
CHANGED
@@ -171,17 +171,15 @@ if st.button("Sentiment Analysis", type="secondary"):
|
|
171 |
st.plotly_chart(fig2)
|
172 |
|
173 |
text = " ".join(comment for comment in df['Comment'])
|
174 |
-
|
175 |
text = re.sub('[^A-Za-z]+', ' ', text)
|
176 |
words = text.split()
|
177 |
-
clean_text = [word for word in words if word.lower() not in
|
178 |
clean_text = ' '.join(clean_text)
|
179 |
-
stopwords = set(stopwords.words('english'))
|
180 |
wc = WordCloud(width=800, height=400, background_color='white').generate(clean_text)
|
181 |
-
fig = plt.figure(figsize=(12,6))
|
182 |
plt.imshow(wc, interpolation='bilinear')
|
183 |
plt.axis('off')
|
184 |
-
|
185 |
st.pyplot(fig)
|
186 |
|
187 |
|
|
|
171 |
st.plotly_chart(fig2)
|
172 |
|
173 |
text = " ".join(comment for comment in df['Comment'])
|
174 |
+
stopwords_set = set(stopwords.words('english')) # Correct import and usage
|
175 |
text = re.sub('[^A-Za-z]+', ' ', text)
|
176 |
words = text.split()
|
177 |
+
clean_text = [word for word in words if word.lower() not in stopwords_set]
|
178 |
clean_text = ' '.join(clean_text)
|
|
|
179 |
wc = WordCloud(width=800, height=400, background_color='white').generate(clean_text)
|
180 |
+
fig = plt.figure(figsize=(12, 6))
|
181 |
plt.imshow(wc, interpolation='bilinear')
|
182 |
plt.axis('off')
|
|
|
183 |
st.pyplot(fig)
|
184 |
|
185 |
|