From 2426597e78725720b5a476fecdde04e32b14a560 Mon Sep 17 00:00:00 2001 From: Abhinav Duvvuri Date: Wed, 13 Mar 2024 10:01:57 -0700 Subject: [PATCH 1/5] Added decriptions to each chart --- thronetalk-game-of-thrones-summarizer/app.py | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/thronetalk-game-of-thrones-summarizer/app.py b/thronetalk-game-of-thrones-summarizer/app.py index 045117c..a5c533f 100644 --- a/thronetalk-game-of-thrones-summarizer/app.py +++ b/thronetalk-game-of-thrones-summarizer/app.py @@ -70,7 +70,7 @@ def remove_zeros(lst): filtered_to_episode, key = 2) to_ep_no = selected_episode_to.split()[4] submitted = st.sidebar.button("Generate Summary") -H1 = "Sentiment Analysis & Word Clouds from" +H1 = "Sentiment Scores Across " out_text_temp = f"**Episode Summary from {selected_episode_from} to {selected_episode_to}**" out_text_temp2 = f"**{H1} {selected_episode_from} to {selected_episode_to}**" season_from = int(season_from) @@ -90,6 +90,13 @@ def remove_zeros(lst): #st.write(characters_tuple) characters = list(characters_tuple) st.subheader(out_text_temp2) + st.markdown('''This line chart visualizes the ***sentiment scores*** across seasons and episodes + for the top 3 most active characters within the range selected by the user, + based ***on-screen time***. Sentiment scores reflect the emotional tone of dialogue + and actions, with positive scores indicating positive sentiment and negative scores + indicating negative sentiment. This visualization allows users to track the + emotional journey of key characters throughout the series, identifying trends, + patterns, and significant moments in their development.''') vg = VisualizationGenerator( int(season_from), int(from_ep_no), @@ -97,6 +104,8 @@ def remove_zeros(lst): int(to_ep_no) ) line_chart = vg.sentiment_analysis_visualization(characters) + line_chart = vg.sentiment_analysis_visualization(characters) + print(characters) chart = alt.Chart(line_chart).transform_fold( characters, as_=["character name", "value"] ).mark_line( @@ -127,6 +136,16 @@ def remove_zeros(lst): # strokeWidth=2 # ) st.altair_chart(chart,use_container_width=True) + H2 = "Word Cloud of top 3 characters from " + out_text_2 = f"**{H2} {selected_episode_from} to {selected_episode_to}**" + st.subheader(out_text_2) + st.markdown('''These word clouds display the most frequently used words + associated with the top 3 characters selected from the sentiment + analysis above. Each word cloud visually represents the prominence + of words in the dialogue or actions of these characters throughout + the selected seasons and episodes. Larger words indicate higher + frequency of use, offering users a glimpse into the key themes, + topics, and attributes associated with each character.''') columns = st.columns(len(characters)) wordcloud = vg.multi_word_cloud(characters) plots = [] From d2e3781585032c471393e891568e0169c9410205 Mon Sep 17 00:00:00 2001 From: Abhinav Duvvuri Date: Wed, 13 Mar 2024 10:01:57 -0700 Subject: [PATCH 2/5] Added decriptions to each chart --- thronetalk-game-of-thrones-summarizer/app.py | 21 +++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/thronetalk-game-of-thrones-summarizer/app.py b/thronetalk-game-of-thrones-summarizer/app.py index d436b50..3690ea8 100644 --- a/thronetalk-game-of-thrones-summarizer/app.py +++ b/thronetalk-game-of-thrones-summarizer/app.py @@ -70,7 +70,7 @@ def remove_zeros(lst): filtered_to_episode, key = 2) to_ep_no = selected_episode_to.split()[4] submitted = st.sidebar.button("Generate Summary") -H1 = "Sentiment Analysis & Word Clouds from" +H1 = "Sentiment Scores Across " out_text_temp = f"**Episode Summary from {selected_episode_from} to {selected_episode_to}**" out_text_temp2 = f"**{H1} {selected_episode_from} to {selected_episode_to}**" season_from = int(season_from) @@ -90,6 +90,13 @@ def remove_zeros(lst): #st.write(characters_tuple) characters = list(characters_tuple) st.subheader(out_text_temp2) + st.markdown('''This line chart visualizes the ***sentiment scores*** across seasons and episodes + for the top 3 most active characters within the range selected by the user, + based ***on-screen time***. Sentiment scores reflect the emotional tone of dialogue + and actions, with positive scores indicating positive sentiment and negative scores + indicating negative sentiment. This visualization allows users to track the + emotional journey of key characters throughout the series, identifying trends, + patterns, and significant moments in their development.''') vg = VisualizationGenerator( int(season_from), int(from_ep_no), @@ -97,6 +104,8 @@ def remove_zeros(lst): int(to_ep_no) ) line_chart = vg.sentiment_analysis_visualization(characters) + line_chart = vg.sentiment_analysis_visualization(characters) + print(characters) chart = alt.Chart(line_chart).transform_fold( characters, as_=["character name", "value"] ).mark_line( @@ -111,6 +120,16 @@ def remove_zeros(lst): ) st.altair_chart(chart,use_container_width=True) + H2 = "Word Cloud of top 3 characters from " + out_text_2 = f"**{H2} {selected_episode_from} to {selected_episode_to}**" + st.subheader(out_text_2) + st.markdown('''These word clouds display the most frequently used words + associated with the top 3 characters selected from the sentiment + analysis above. Each word cloud visually represents the prominence + of words in the dialogue or actions of these characters throughout + the selected seasons and episodes. Larger words indicate higher + frequency of use, offering users a glimpse into the key themes, + topics, and attributes associated with each character.''') columns = st.columns(len(characters)) wordcloud = vg.multi_word_cloud(characters) plots = [] From e7bc15093384ec6f4a3d01b581da4ab856c28616 Mon Sep 17 00:00:00 2001 From: Abhinav Duvvuri Date: Wed, 13 Mar 2024 10:15:42 -0700 Subject: [PATCH 3/5] added testing changes to reflect UI changes --- thronetalk-game-of-thrones-summarizer/tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thronetalk-game-of-thrones-summarizer/tests/test_app.py b/thronetalk-game-of-thrones-summarizer/tests/test_app.py index 673162b..59e1b39 100644 --- a/thronetalk-game-of-thrones-summarizer/tests/test_app.py +++ b/thronetalk-game-of-thrones-summarizer/tests/test_app.py @@ -65,7 +65,7 @@ def test_headers(self, _): self.mock_input() from_ep_full2 = self.app_test.sidebar.selectbox[1].value to_ep_full2 = self.app_test.sidebar.selectbox[3].value - sub_header1= f"**Sentiment Analysis & Word Clouds from {from_ep_full2} to {to_ep_full2}**" + sub_header1= f"**Sentiment Scores Across {from_ep_full2} to {to_ep_full2}**" sub_header2= f"**Episode Summary from {from_ep_full2} to {to_ep_full2}**" episode_summary_subheader = self.app_test.subheader[4].value sentiment_analysis_subheader = self.app_test.subheader[0].value From ab042e18085088bd8ab48d290e6cf717f5d71fa9 Mon Sep 17 00:00:00 2001 From: Abhinav Duvvuri Date: Wed, 13 Mar 2024 10:20:44 -0700 Subject: [PATCH 4/5] bug fix for header item test --- thronetalk-game-of-thrones-summarizer/app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thronetalk-game-of-thrones-summarizer/app.py b/thronetalk-game-of-thrones-summarizer/app.py index 3690ea8..d4fd586 100644 --- a/thronetalk-game-of-thrones-summarizer/app.py +++ b/thronetalk-game-of-thrones-summarizer/app.py @@ -70,7 +70,7 @@ def remove_zeros(lst): filtered_to_episode, key = 2) to_ep_no = selected_episode_to.split()[4] submitted = st.sidebar.button("Generate Summary") -H1 = "Sentiment Scores Across " +H1 = "Sentiment Scores Across" out_text_temp = f"**Episode Summary from {selected_episode_from} to {selected_episode_to}**" out_text_temp2 = f"**{H1} {selected_episode_from} to {selected_episode_to}**" season_from = int(season_from) From aad9934678724d63bb11b9d66314369653a776e9 Mon Sep 17 00:00:00 2001 From: Abhinav Duvvuri Date: Wed, 13 Mar 2024 11:00:29 -0700 Subject: [PATCH 5/5] Made changes to subheader for tests --- thronetalk-game-of-thrones-summarizer/tests/test_app.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thronetalk-game-of-thrones-summarizer/tests/test_app.py b/thronetalk-game-of-thrones-summarizer/tests/test_app.py index 59e1b39..a86d1b3 100644 --- a/thronetalk-game-of-thrones-summarizer/tests/test_app.py +++ b/thronetalk-game-of-thrones-summarizer/tests/test_app.py @@ -67,7 +67,7 @@ def test_headers(self, _): to_ep_full2 = self.app_test.sidebar.selectbox[3].value sub_header1= f"**Sentiment Scores Across {from_ep_full2} to {to_ep_full2}**" sub_header2= f"**Episode Summary from {from_ep_full2} to {to_ep_full2}**" - episode_summary_subheader = self.app_test.subheader[4].value + episode_summary_subheader = self.app_test.subheader[5].value sentiment_analysis_subheader = self.app_test.subheader[0].value self.assertEqual(sentiment_analysis_subheader,sub_header1) self.assertEqual(episode_summary_subheader,sub_header2)