Spaces:
Runtime error
Runtime error
Update eda.py
Browse files
eda.py
CHANGED
@@ -18,7 +18,7 @@ def label_sentiment(rating):
|
|
18 |
def process_review(review):
|
19 |
"""Simple processing for the review text."""
|
20 |
review = review.lower()
|
21 |
-
review = re.sub(r'[^a-z\s]', '', review)
|
22 |
return review
|
23 |
|
24 |
def display_eda(data):
|
@@ -48,7 +48,7 @@ def display_eda(data):
|
|
48 |
subset = data[data['sentiment'] == sentiment]
|
49 |
text = " ".join(process_review(review) for review in subset['review_description'])
|
50 |
wordcloud = WordCloud(max_words=100, background_color="white").generate(text)
|
51 |
-
plt.figure()
|
52 |
plt.imshow(wordcloud, interpolation="bilinear")
|
53 |
plt.axis("off")
|
54 |
-
st.pyplot()
|
|
|
18 |
def process_review(review):
|
19 |
"""Simple processing for the review text."""
|
20 |
review = review.lower()
|
21 |
+
review = re.sub(r'[^a-z\s]', '', review) # Remove non-alphabetical characters
|
22 |
return review
|
23 |
|
24 |
def display_eda(data):
|
|
|
48 |
subset = data[data['sentiment'] == sentiment]
|
49 |
text = " ".join(process_review(review) for review in subset['review_description'])
|
50 |
wordcloud = WordCloud(max_words=100, background_color="white").generate(text)
|
51 |
+
fig = plt.figure()
|
52 |
plt.imshow(wordcloud, interpolation="bilinear")
|
53 |
plt.axis("off")
|
54 |
+
st.pyplot(fig)
|