File size: 936 Bytes
0387564
 
 
a005a37
f1de1a0
0387564
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
from textblob import TextBlob

st.header("Sentiment Analyzer 2 -- Textblob")
st.write("""
"Input text and submit. First, the machine will present a sentiment score. A score closer to 1 indicates the machine classifying the text as containing positive sentiment. A score closer to -1 indicates the machine classifying the text as containing negative sentiment. 

Furthermore, the machine will present a subjectivity score. A score closer to 1 indicates the machine classifying the text as containing most subjectivity whereas a score closer to 0 indicates the text as containing most objectivity." 
""")

input = st.text_input("Input text and submit.")

if st.button("Submit"):
  analysis = TextBlob(input)
  polarity_score = analysis.sentiment.polarity
  subjectivity_score = analysis.sentiment.subjectivity
  
  st.write("Sentiment score: ", str(polarity_score), "Subjectivity score: ", str(subjectivity_score))