Spaces:
Runtime error
Runtime error
update app.py
Browse filesmodifying the `plot_new_wc` method to plot the word cloud in horizontal manner
app.py
CHANGED
@@ -442,25 +442,46 @@ def generate_wc(processed_expt_df):
|
|
442 |
return positive_wc, negative_wc, neutral_wc
|
443 |
|
444 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
445 |
def plot_news_wc(positive_wc, negative_wc, neutral_wc):
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
|
|
450 |
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
|
463 |
-
|
464 |
|
465 |
def get_news_wc(expt_df):
|
466 |
processed_expt_df = preprocessing_data(expt_df)
|
|
|
442 |
return positive_wc, negative_wc, neutral_wc
|
443 |
|
444 |
|
445 |
+
# def plot_news_wc(positive_wc, negative_wc, neutral_wc):
|
446 |
+
# fig, axs = plt.subplots(1, 3, figsize=(20, 20))
|
447 |
+
# ax1 = axs[0]
|
448 |
+
# ax2 = axs[1]
|
449 |
+
# ax3 = axs[2]
|
450 |
+
|
451 |
+
# ax1.imshow(positive_wc)
|
452 |
+
# ax1.axis('off')
|
453 |
+
# ax1.set_title('WordCloud for Positive Words in News', size=18, pad=20)
|
454 |
+
|
455 |
+
# ax2.imshow(negative_wc)
|
456 |
+
# ax2.axis('off')
|
457 |
+
# ax2.set_title('WordCloud for Negative Words in News', size=18, pad=20)
|
458 |
+
|
459 |
+
# ax3.imshow(neutral_wc)
|
460 |
+
# ax3.axis('off')
|
461 |
+
# ax3.set_title('WordCloud for Neutral Words in News', size=18, pad=20)
|
462 |
+
|
463 |
+
# return fig
|
464 |
+
|
465 |
def plot_news_wc(positive_wc, negative_wc, neutral_wc):
|
466 |
+
fig, axs = plt.subplots(3, 1, figsize=(10, 30)) # 3 rows, 1 column
|
467 |
+
|
468 |
+
ax1 = axs[0]
|
469 |
+
ax2 = axs[1]
|
470 |
+
ax3 = axs[2]
|
471 |
|
472 |
+
ax1.imshow(positive_wc)
|
473 |
+
ax1.axis('off')
|
474 |
+
ax1.set_title('WordCloud for Positive Words in News', size=18, pad=20)
|
475 |
|
476 |
+
ax2.imshow(negative_wc)
|
477 |
+
ax2.axis('off')
|
478 |
+
ax2.set_title('WordCloud for Negative Words in News', size=18, pad=20)
|
479 |
|
480 |
+
ax3.imshow(neutral_wc)
|
481 |
+
ax3.axis('off')
|
482 |
+
ax3.set_title('WordCloud for Neutral Words in News', size=18, pad=20)
|
483 |
|
484 |
+
return fig
|
485 |
|
486 |
def get_news_wc(expt_df):
|
487 |
processed_expt_df = preprocessing_data(expt_df)
|