-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (29 loc) · 955 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import streamlit as st
import numpy as np
import pandas as pd
import textblob
from textblob import TextBlob
st.title("Identifying Incorrect Ratings")
st.header("Bad Review")
file = st.sidebar.file_uploader("Choose a CSV file", type="csv")
if file is not None:
data = pd.read_csv(file)
else:
st.text("Please upload a csv file")
if st.button("Click for Results"):
df = data[['Text', 'Star']]
df = df[df.Star != 5]
df = df[df.Star != 4]
df = df[df.Star != 3]
df.head()
senti_list = []
for i in df["Text"]:
if (TextBlob(i).sentiment[0] > 0):
senti_list.append('Positive')
elif (TextBlob(i).sentiment[0] < 0):
senti_list.append('Negative')
else:
senti_list.append('Neutral')
df["sentiment"] = senti_list
check_attention = df[(df["sentiment"] == "Positive") & (df["Star"] < 2)]
st.dataframe(check_attention)