-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanual_assessment.py
More file actions
49 lines (39 loc) · 1.45 KB
/
Copy pathmanual_assessment.py
File metadata and controls
49 lines (39 loc) · 1.45 KB
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
38
39
40
41
42
43
44
45
46
47
import pandas as pd
import random
from datetime import datetime
df = pd.read_csv("google_output_with_sentiment.csv")
df['Date'] = pd.to_datetime(df['Date'], format='%Y%m%d')
POSITIVE_CUTOFF = 0.5
NEGATIVE_CUTOFF = -0.5
SAMPLE_SIZE = 3
DATE_CUTOFF = datetime.strptime("20221130", '%Y%m%d')
positive = df[df.Sentiment_Score > POSITIVE_CUTOFF]
negative = df[df.Sentiment_Score < NEGATIVE_CUTOFF]
neutral = df[df.Sentiment_Score < POSITIVE_CUTOFF]
neutral = neutral[neutral.Sentiment_Score > NEGATIVE_CUTOFF]
neutral_before = neutral[neutral.Date < DATE_CUTOFF]
print("************NEXT RUN*************")
print("MANUAL EVALUATION POSITIVE:")
indices = random.sample(range(len(positive)),SAMPLE_SIZE)
for i in indices:
datapoint = positive.iloc[i]
print(str(i) + ":")
print("Sentiment score: ", datapoint.Sentiment_Score)
print("Main text:", datapoint.MainText)
print()
print("MANUAL EVALUATION NEUTRAL BEFORE:")
indices = random.sample(range(len(neutral_before)),SAMPLE_SIZE)
for i in indices:
datapoint = neutral_before.iloc[i]
print(str(i) + ":")
print("Sentiment score: ", datapoint.Sentiment_Score)
print("Main text:", datapoint.MainText)
print()
print("MANUAL EVALUATION NEGATIVE:")
indices = random.sample(range(len(negative)),SAMPLE_SIZE)
for i in indices:
datapoint = negative.iloc[i]
print(str(i) + ":")
print("Sentiment score: ", datapoint.Sentiment_Score)
print("Main text:", datapoint.MainText)
print()