nickmuchi commited on
Commit
0f2bd46
β€’
1 Parent(s): 80b1e90

Update pages/1_Earnings_Sentiment_Analysis_πŸ“ˆ_.py

Browse files
pages/1_Earnings_Sentiment_Analysis_πŸ“ˆ_.py CHANGED
@@ -14,9 +14,6 @@ st.subheader(title)
14
 
15
  earnings_passages = results['text']
16
 
17
- with st.expander("See Transcribed Earnings Text"):
18
- st.write(earnings_passages)
19
-
20
  with open('earnings.txt','w') as f:
21
  f.write(earnings_passages)
22
 
@@ -25,6 +22,12 @@ with open('earnings.txt','r') as f:
25
 
26
  earnings_sentiment, earnings_sentences = sent_pipe(earnings_passages)
27
 
 
 
 
 
 
 
28
  ## Save to a dataframe for ease of visualization
29
  sen_df = pd.DataFrame(earnings_sentiment)
30
  sen_df['text'] = earnings_sentences
@@ -48,7 +51,9 @@ fig.update_layout(
48
  )
49
  )
50
 
51
- st.plotly_chart(fig)
 
 
52
 
53
  ## Display sentiment score
54
  pos_perc = grouped[grouped['sentiment']=='Positive']['count'].iloc[0]*100/sen_df.shape[0]
@@ -81,6 +86,8 @@ fig.update_layout(
81
  )
82
  )
83
 
 
 
84
  ## Display negative sentence locations
85
  fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=['text'], color_discrete_map={"Negative":"firebrick","Neutral":"navajowhite","Positive":"darkgreen"}, title='Sentiment Score Distribution')
86
 
 
14
 
15
  earnings_passages = results['text']
16
 
 
 
 
17
  with open('earnings.txt','w') as f:
18
  f.write(earnings_passages)
19
 
 
22
 
23
  earnings_sentiment, earnings_sentences = sent_pipe(earnings_passages)
24
 
25
+ with st.expander("See Transcribed Earnings Text"):
26
+ st.write(f"Number of Sentences: {len(earnings_ssentences)}")
27
+
28
+ st.write(earnings_passages)
29
+
30
+
31
  ## Save to a dataframe for ease of visualization
32
  sen_df = pd.DataFrame(earnings_sentiment)
33
  sen_df['text'] = earnings_sentences
 
51
  )
52
  )
53
 
54
+ col1, col2 = st.columns(2)
55
+
56
+ col1.plotly_chart(fig)
57
 
58
  ## Display sentiment score
59
  pos_perc = grouped[grouped['sentiment']=='Positive']['count'].iloc[0]*100/sen_df.shape[0]
 
86
  )
87
  )
88
 
89
+ col2.plotly_chart(fig)
90
+
91
  ## Display negative sentence locations
92
  fig = px.scatter(sen_df, y='label', color='label', size='score', hover_data=['text'], color_discrete_map={"Negative":"firebrick","Neutral":"navajowhite","Positive":"darkgreen"}, title='Sentiment Score Distribution')
93