Commit c6a519eaaf663871d6a35e84df0913270c472f83

Authored by Tássia Camões Araújo
1 parent 3ab5f2c0
Exists in master and in 1 other branch add_vagrant

Created new option 'index_mode', that can be set to '0' (use old index), '10' (r…

…eindex) or '11' (reindex with clustering).
Showing 1 changed file with 18 additions and 18 deletions   Show diff stats
@@ -44,7 +44,7 @@ class Config(): @@ -44,7 +44,7 @@ class Config():
44 self.popcon_index = os.path.expanduser("~/.app-recommender/popcon_index") 44 self.popcon_index = os.path.expanduser("~/.app-recommender/popcon_index")
45 self.popcon_dir = os.path.expanduser("~/.app-recommender/popcon_dir") 45 self.popcon_dir = os.path.expanduser("~/.app-recommender/popcon_dir")
46 self.clusters_dir = os.path.expanduser("~/.app-recommender/clusters_dir") 46 self.clusters_dir = os.path.expanduser("~/.app-recommender/clusters_dir")
47 - self.clustering = 1 47 + self.index_mode = "0" # use old index
48 self.strategy = "cb" 48 self.strategy = "cb"
49 self.weight = "bm25" 49 self.weight = "bm25"
50 self.load_options() 50 self.load_options()
@@ -56,23 +56,23 @@ class Config(): @@ -56,23 +56,23 @@ class Config():
56 """ 56 """
57 print "\n [ general ]" 57 print "\n [ general ]"
58 print " -h, --help Print this help" 58 print " -h, --help Print this help"
59 - print " -d, --debug Set logging level to debug."  
60 - print " -v, --verbose Set logging level to verbose."  
61 - print " -o, --output=PATH Path to file to save output."  
62 - print " -c, --config=PATH Path to configuration file." 59 + print " -d, --debug Set logging level to debug"
  60 + print " -v, --verbose Set logging level to verbose"
  61 + print " -o, --output=PATH Path to file to save output"
  62 + print " -c, --config=PATH Path to configuration file"
63 print "" 63 print ""
64 print " [ recommender ]" 64 print " [ recommender ]"
65 - print " -a, --axi=PATH Path to Apt-xapian-index."  
66 - print " -p, --popconindex=PATH Path to popcon dedicated index."  
67 - print " -m, --popcondir=PATH Path to popcon submissions dir."  
68 - print " -u, --clustering If popcon data should be clustered."  
69 - print " -l, --clustersdir=PATH Path to popcon clusters dir."  
70 - print " -w, --weight=OPTION Search weighting scheme."  
71 - print " -s, --strategy=OPTION Recommendation strategy." 65 + print " -a, --axi=PATH Path to Apt-xapian-index"
  66 + print " -p, --popconindex=PATH Path to popcon dedicated index"
  67 + print " -m, --popcondir=PATH Path to popcon submissions dir"
  68 + print " -u, --index_mode= 0: old, 1:reindex, 11:clustered_index"
  69 + print " -l, --clustersdir=PATH Path to popcon clusters dir"
  70 + print " -w, --weight=OPTION Search weighting scheme"
  71 + print " -s, --strategy=OPTION Recommendation strategy"
72 print "" 72 print ""
73 print " [ weight options ] " 73 print " [ weight options ] "
74 - print " trad = traditional probabilistic weighting "  
75 - print " bm25 = bm25 weighting scheme " 74 + print " trad = traditional probabilistic weighting"
  75 + print " bm25 = bm25 weighting scheme"
76 print "" 76 print ""
77 print " [ strategy options ] " 77 print " [ strategy options ] "
78 print " cb = content-based " 78 print " cb = content-based "
@@ -113,14 +113,14 @@ class Config(): @@ -113,14 +113,14 @@ class Config():
113 self.axi = self.read_option('recommender', 'axi') 113 self.axi = self.read_option('recommender', 'axi')
114 self.popcon_index = self.read_option('recommender', 'popcon_index') 114 self.popcon_index = self.read_option('recommender', 'popcon_index')
115 self.popcon_dir = self.read_option('recommender', 'popcon_dir') 115 self.popcon_dir = self.read_option('recommender', 'popcon_dir')
116 - self.clustering = self.read_option('recommender', 'clustering') 116 + self.index_mode = self.read_option('recommender', 'index_mode')
117 self.clusters_dir = self.read_option('recommender', 'clusters_dir') 117 self.clusters_dir = self.read_option('recommender', 'clusters_dir')
118 self.weight = self.read_option('recommender', 'weight') 118 self.weight = self.read_option('recommender', 'weight')
119 self.strategy = self.read_option('recommender', 'strategy') 119 self.strategy = self.read_option('recommender', 'strategy')
120 120
121 short_options = "hdvo:c:a:p:m:ul:w:s:" 121 short_options = "hdvo:c:a:p:m:ul:w:s:"
122 long_options = ["help", "debug", "verbose", "output=", "config=", 122 long_options = ["help", "debug", "verbose", "output=", "config=",
123 - "axi=", "popconindex=", "popcondir=", "clustering", 123 + "axi=", "popconindex=", "popcondir=", "index_mode=",
124 "clusters_dir=", "weight=", "strategy="] 124 "clusters_dir=", "weight=", "strategy="]
125 try: 125 try:
126 opts, args = getopt.getopt(sys.argv[1:], short_options, 126 opts, args = getopt.getopt(sys.argv[1:], short_options,
@@ -150,8 +150,8 @@ class Config(): @@ -150,8 +150,8 @@ class Config():
150 self.popcon_index = p 150 self.popcon_index = p
151 elif o in ("-m", "--popcondir"): 151 elif o in ("-m", "--popcondir"):
152 self.popcon_dir = p 152 self.popcon_dir = p
153 - elif o in ("-u", "--clustering"):  
154 - self.clustering = 1 153 + elif o in ("-u", "--index_mode"):
  154 + self.index_mode = p
155 elif o in ("-l", "--clustersdir"): 155 elif o in ("-l", "--clustersdir"):
156 self.clusters_dir = p 156 self.clusters_dir = p
157 elif o in ("-w", "--weight"): 157 elif o in ("-w", "--weight"):