-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsim_table.py
60 lines (47 loc) · 1.47 KB
/
sim_table.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from topic.topicio import TopicIO
from similarity.SimTopicLists import SimTopicLists
import sys
import utils.name_convention as name
topics_io = TopicIO()
stl = SimTopicLists()
if len(sys.argv) <= 1:
corpus_type = "bow"
else:
if sys.argv[1] == "t":
corpus_type = "tfidf"
elif sys.argv[1] == "b":
corpus_type = "binary"
else:
corpus_type = "bow"
if len(sys.argv) <= 2:
topics_count = 3
else:
topics_count = int(sys.argv[2])
if len(sys.argv) <= 3:
src = "pp_reuters"
else:
src = sys.argv[3]
dtw = name.get_output_dir(corpus_type, topics_count, src)
t_1 = dtw + "/topics"
t_list1 = topics_io.read_topics(t_1)
jlist = stl.jaccard(t_list1, t_list1, 500)
klist = stl.kendall(t_list1, t_list1)
dlist = stl.dcg(t_list1, t_list1)
ofname = dtw + "/self-comp_jaccard.txt"
dist_output = open(ofname, "w")
stl.show_results_2min_self(jlist, dist_output)
ofname = dtw + "/self-comp_kendell.txt"
dist_output = open(ofname, "w")
stl.show_results_2min_self(klist, dist_output)
ofname = dtw + "/self-comp_dcg.txt"
dist_output = open(ofname, "w")
stl.show_results_self(dlist, dist_output)
ofname = dtw + "/self-comp_rank_jaccard.html"
dist_output = open(ofname, "w")
stl.show_results_rank_bw(jlist, dist_output)
ofname = dtw + "/self-comp_rank_kendell.html"
dist_output = open(ofname, "w")
stl.show_results_rank_bw(klist, dist_output)
ofname = dtw + "/self-comp_rank_dcg.html"
dist_output = open(ofname, "w")
stl.show_results_rank_bw(dlist, dist_output)