rajesh1729 commited on
Commit
7b525b4
·
1 Parent(s): d4cb7bd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -9,6 +9,22 @@ side = st.sidebar.selectbox("Select an option below", ("Sentiment", "Subjectivit
9
  Text = st.text_input("Enter the sentence")
10
 
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  @st.cache
14
  def subjectivity(text):
 
9
  Text = st.text_input("Enter the sentence")
10
 
11
 
12
+ @st.cache
13
+ def sentiment(text):
14
+ nlp = spacy.load('en_core_web_sm')
15
+ nlp.add_pipe('spacytextblob')
16
+ doc = nlp(text)
17
+ if doc._.polarity<0:
18
+ return "Negative"
19
+ elif doc._.polarity==0:
20
+ return "Neutral"
21
+ else:
22
+ return "Positive"
23
+
24
+
25
+
26
+
27
+
28
 
29
  @st.cache
30
  def subjectivity(text):