Commit 75de27a96394f87c834f0fbd842f281942026927
1 parent
e77dc1ed
Exists in
master
and in
1 other branch
Added option for recommender weighting scheme and removed debtags_db options.
Showing
1 changed file
with
19 additions
and
23 deletions
Show diff stats
src/config.py
@@ -46,8 +46,8 @@ class Config(): | @@ -46,8 +46,8 @@ class Config(): | ||
46 | self.popcon_index = "~/.app-recommender/popcon_index" | 46 | self.popcon_index = "~/.app-recommender/popcon_index" |
47 | self.popcon_dir = "~/.app-recommender/popcon_dir" | 47 | self.popcon_dir = "~/.app-recommender/popcon_dir" |
48 | self.clusters_dir = "~/.app-recommender/clusters_dir" | 48 | self.clusters_dir = "~/.app-recommender/clusters_dir" |
49 | - self.strategy = "cta" # defaults to the cheapest one | ||
50 | - self.reindex = 0 | 49 | + self.strategy = "cb" # defaults to the cheapest one |
50 | + self.weight = "bm25" | ||
51 | self.load_options() | 51 | self.load_options() |
52 | self.set_logger() | 52 | self.set_logger() |
53 | 53 | ||
@@ -63,22 +63,24 @@ class Config(): | @@ -63,22 +63,24 @@ class Config(): | ||
63 | print " -c, --config=PATH Path to configuration file." | 63 | print " -c, --config=PATH Path to configuration file." |
64 | print "" | 64 | print "" |
65 | print " [ recommender ]" | 65 | print " [ recommender ]" |
66 | - print " -t, --tagsdb=PATH Path to debtags database." | ||
67 | - print " -i, --tagsindex=PATH Path to debtags dedicated index." | ||
68 | - print " -r, --force-reindex Force reindexing debtags database." | ||
69 | print " -a, --axi=PATH Path to Apt-xapian-index." | 66 | print " -a, --axi=PATH Path to Apt-xapian-index." |
70 | print " -p, --popconindex=PATH Path to popcon dedicated index." | 67 | print " -p, --popconindex=PATH Path to popcon dedicated index." |
71 | print " -m, --popcondir=PATH Path to popcon submissions dir." | 68 | print " -m, --popcondir=PATH Path to popcon submissions dir." |
72 | print " -l, --clustersdir=PATH Path to popcon clusters dir." | 69 | print " -l, --clustersdir=PATH Path to popcon clusters dir." |
70 | + print " -w, --weight=OPTION Search weighting scheme." | ||
73 | print " -s, --strategy=OPTION Recommendation strategy." | 71 | print " -s, --strategy=OPTION Recommendation strategy." |
74 | print "" | 72 | print "" |
73 | + print " [ weight options ] " | ||
74 | + print " trad = traditional probabilistic weighting " | ||
75 | + print " bm25 = bm25 weighting scheme " | ||
76 | + print "" | ||
75 | print " [ strategy options ] " | 77 | print " [ strategy options ] " |
76 | - print " ct = content-based using tags " | ||
77 | - print " cta = content-based using tags via apt-xapian-index" | ||
78 | - print " cp = content-based using package descriptions " | 78 | + print " cb = content-based " |
79 | + print " cbt = content-based using only tags as content " | ||
80 | + print " cbd = content-based using only package descriptions as content " | ||
79 | print " col = collaborative " | 81 | print " col = collaborative " |
80 | - print " colct = collaborative through tags content " | ||
81 | - print " colcp = collaborative through package descriptions content " | 82 | + #print " colct = collaborative through tags content " |
83 | + #print " colcp = collaborative through package descriptions content " | ||
82 | 84 | ||
83 | def read_option(self, section, option): | 85 | def read_option(self, section, option): |
84 | """ | 86 | """ |
@@ -108,19 +110,17 @@ class Config(): | @@ -108,19 +110,17 @@ class Config(): | ||
108 | self.output_filename = self.read_option('general', 'output') | 110 | self.output_filename = self.read_option('general', 'output') |
109 | self.config = self.read_option('general', 'config') | 111 | self.config = self.read_option('general', 'config') |
110 | 112 | ||
111 | - self.tags_db = self.read_option('recommender', 'tags_db') | ||
112 | - self.tags_index = self.read_option('recommender', 'tags_index') | ||
113 | - self.reindex = self.read_option('recommender', 'reindex') | ||
114 | self.axi = self.read_option('recommender', 'axi') | 113 | self.axi = self.read_option('recommender', 'axi') |
115 | self.popcon_index = self.read_option('recommender', 'popcon_index') | 114 | self.popcon_index = self.read_option('recommender', 'popcon_index') |
116 | self.popcon_dir = self.read_option('recommender', 'popcon_dir') | 115 | self.popcon_dir = self.read_option('recommender', 'popcon_dir') |
117 | self.clusters_dir = self.read_option('recommender', 'clusters_dir') | 116 | self.clusters_dir = self.read_option('recommender', 'clusters_dir') |
117 | + self.weight = self.read_option('recommender', 'weight') | ||
118 | + self.strategy = self.read_option('recommender', 'strategy') | ||
118 | 119 | ||
119 | - short_options = "hdvo:c:t:i:ra:p:m:s:" | 120 | + short_options = "hdvo:c:a:p:m:l:w:s:" |
120 | long_options = ["help", "debug", "verbose", "output=", "config=", | 121 | long_options = ["help", "debug", "verbose", "output=", "config=", |
121 | - "tagsdb=", "tagsindex=", "reindex", "axi=", | ||
122 | - "popconindex=", "popcondir=", "clustersdir=", | ||
123 | - "strategy="] | 122 | + "axi=", "popconindex=", "popcondir=", "clustersdir=", |
123 | + "weight=", "strategy="] | ||
124 | try: | 124 | try: |
125 | opts, args = getopt.getopt(sys.argv[1:], short_options, | 125 | opts, args = getopt.getopt(sys.argv[1:], short_options, |
126 | long_options) | 126 | long_options) |
@@ -142,12 +142,6 @@ class Config(): | @@ -142,12 +142,6 @@ class Config(): | ||
142 | self.output = p | 142 | self.output = p |
143 | elif o in ("-c", "--config"): | 143 | elif o in ("-c", "--config"): |
144 | self.config = p | 144 | self.config = p |
145 | - elif o in ("-t", "--tagsdb"): | ||
146 | - self.tags_db = p | ||
147 | - elif o in ("-i", "--tagsindex"): | ||
148 | - self.tags_index = p | ||
149 | - elif o in ("-r", "--force-reindex"): | ||
150 | - self.reindex = 1 | ||
151 | elif o in ("-a", "--axi"): | 145 | elif o in ("-a", "--axi"): |
152 | self.axi = p + "/index" | 146 | self.axi = p + "/index" |
153 | self.axi_values = p + "/values" | 147 | self.axi_values = p + "/values" |
@@ -157,6 +151,8 @@ class Config(): | @@ -157,6 +151,8 @@ class Config(): | ||
157 | self.popcon_dir = p | 151 | self.popcon_dir = p |
158 | elif o in ("-l", "--clustersdir"): | 152 | elif o in ("-l", "--clustersdir"): |
159 | self.popcon_dir = p | 153 | self.popcon_dir = p |
154 | + elif o in ("-w", "--weight"): | ||
155 | + self.weight = p | ||
160 | elif o in ("-s", "--strategy"): | 156 | elif o in ("-s", "--strategy"): |
161 | self.strategy = p | 157 | self.strategy = p |
162 | else: | 158 | else: |