Spaces:
Runtime error
Runtime error
Commit
·
1268a0a
1
Parent(s):
7b525b4
Update app.py
Browse files
app.py
CHANGED
@@ -22,10 +22,6 @@ def sentiment(text):
|
|
22 |
return "Positive"
|
23 |
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
@st.cache
|
30 |
def subjectivity(text):
|
31 |
nlp = spacy.load('en_core_web_sm')
|
@@ -48,29 +44,15 @@ def ner(sentence):
|
|
48 |
|
49 |
|
50 |
def run():
|
51 |
-
@st.cache
|
52 |
-
def sentiment(text):
|
53 |
-
nlp = spacy.load('en_core_web_sm')
|
54 |
-
nlp.add_pipe('spacytextblob')
|
55 |
-
doc = nlp(text)
|
56 |
-
if doc._.polarity<0:
|
57 |
-
return "Negative"
|
58 |
-
elif doc._.polarity==0:
|
59 |
-
return "Neutral"
|
60 |
-
else:
|
61 |
-
return "Positive"
|
62 |
-
|
63 |
|
64 |
if side == "Sentiment":
|
65 |
st.write(sentiment(Text))
|
66 |
if side == "Subjectivity":
|
67 |
st.write(subjectivity(Text))
|
68 |
-
|
69 |
if side == "NER":
|
70 |
st.write(ner(Text))
|
71 |
|
72 |
|
73 |
|
74 |
-
|
75 |
if __name__ == '__main__':
|
76 |
run()
|
|
|
22 |
return "Positive"
|
23 |
|
24 |
|
|
|
|
|
|
|
|
|
25 |
@st.cache
|
26 |
def subjectivity(text):
|
27 |
nlp = spacy.load('en_core_web_sm')
|
|
|
44 |
|
45 |
|
46 |
def run():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
if side == "Sentiment":
|
49 |
st.write(sentiment(Text))
|
50 |
if side == "Subjectivity":
|
51 |
st.write(subjectivity(Text))
|
|
|
52 |
if side == "NER":
|
53 |
st.write(ner(Text))
|
54 |
|
55 |
|
56 |
|
|
|
57 |
if __name__ == '__main__':
|
58 |
run()
|