-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpostprocess.py
45 lines (38 loc) · 1.16 KB
/
postprocess.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
38
39
40
41
42
43
44
45
import make_hashrings
import os
import json
def record_highest():
def vertical_similarity():
def horizontal_similarity():
def category_score()
def process():
onions = open("descriptor_list.txt", "r")
for oni in onions:
onion = make_hashrings.stripOnion(oni)
data = os.listdir("/home/mge/%s" % onion)
for datum in data:
datum = datum.strip(".json")
dates = datum.split("-")
yr = dates[0]
mon = dates[1]
day = dates[2]
hr = dates[3]
suffix = "%s-%s-%s-%s" % (yr, mon, day, hr)
hsdirs_json = open("/home/mge/%s/%s.json" % (onion, suffix), "r")
hsdirs = json.load(hsdirs_json)
hsdirs_json.close()
def group_by_category():
categories_to_onions = {}
onions_to_categories = {}
onions = open("descriptor_categories.txt", "r")
current_category = ""
for oni in onions:
if oni.startswith("=="):
cat = oni.strip("==")
current_category = cat
categories_to_onions[current_category] = []
else:
onion = make_hashrings.stripOnion(oni)
categories_to_onions[current_category].append(onion)
onions_to_categories[onion] = current_category
onions.close()