-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.py
27 lines (21 loc) · 854 Bytes
/
test.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
from PhemeDataset import PhemeDatasetES
dataset = PhemeDatasetES(hosts="http://localhost:9200", index_name="pheme_tweet_data")
events = ["charliehebdo", "germanwings-crash", "sydneysiege", "ottawashooting", "ferguson"]
rumor = dict()
non_rumor = dict()
for event in events:
rumor_avg_timespan = 0
rumor_count = 0
non_rumor_avg_timespan = 0
non_rumor_count = 0
a = dataset.read_combined_features_from_file(event)
for t in a:
if t['rumor'] == 0:
non_rumor_avg_timespan += t['time_span']
non_rumor_count += 1
else:
rumor_avg_timespan += t['time_span']
rumor_count += 1
print("EVENT: " + str(event))
print("AVG TIMESPAN RUMOR: " + str(rumor_avg_timespan / rumor_count))
print("AVG TIMESPAN NON-RUMOR: " + str(non_rumor_avg_timespan / non_rumor_count))