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 | 46 | self.popcon_index = "~/.app-recommender/popcon_index" |
| 47 | 47 | self.popcon_dir = "~/.app-recommender/popcon_dir" |
| 48 | 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 | 51 | self.load_options() |
| 52 | 52 | self.set_logger() |
| 53 | 53 | |
| ... | ... | @@ -63,22 +63,24 @@ class Config(): |
| 63 | 63 | print " -c, --config=PATH Path to configuration file." |
| 64 | 64 | print "" |
| 65 | 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 | 66 | print " -a, --axi=PATH Path to Apt-xapian-index." |
| 70 | 67 | print " -p, --popconindex=PATH Path to popcon dedicated index." |
| 71 | 68 | print " -m, --popcondir=PATH Path to popcon submissions dir." |
| 72 | 69 | print " -l, --clustersdir=PATH Path to popcon clusters dir." |
| 70 | + print " -w, --weight=OPTION Search weighting scheme." | |
| 73 | 71 | print " -s, --strategy=OPTION Recommendation strategy." |
| 74 | 72 | print "" |
| 73 | + print " [ weight options ] " | |
| 74 | + print " trad = traditional probabilistic weighting " | |
| 75 | + print " bm25 = bm25 weighting scheme " | |
| 76 | + print "" | |
| 75 | 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 | 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 | 85 | def read_option(self, section, option): |
| 84 | 86 | """ |
| ... | ... | @@ -108,19 +110,17 @@ class Config(): |
| 108 | 110 | self.output_filename = self.read_option('general', 'output') |
| 109 | 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 | 113 | self.axi = self.read_option('recommender', 'axi') |
| 115 | 114 | self.popcon_index = self.read_option('recommender', 'popcon_index') |
| 116 | 115 | self.popcon_dir = self.read_option('recommender', 'popcon_dir') |
| 117 | 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 | 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 | 124 | try: |
| 125 | 125 | opts, args = getopt.getopt(sys.argv[1:], short_options, |
| 126 | 126 | long_options) |
| ... | ... | @@ -142,12 +142,6 @@ class Config(): |
| 142 | 142 | self.output = p |
| 143 | 143 | elif o in ("-c", "--config"): |
| 144 | 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 | 145 | elif o in ("-a", "--axi"): |
| 152 | 146 | self.axi = p + "/index" |
| 153 | 147 | self.axi_values = p + "/values" |
| ... | ... | @@ -157,6 +151,8 @@ class Config(): |
| 157 | 151 | self.popcon_dir = p |
| 158 | 152 | elif o in ("-l", "--clustersdir"): |
| 159 | 153 | self.popcon_dir = p |
| 154 | + elif o in ("-w", "--weight"): | |
| 155 | + self.weight = p | |
| 160 | 156 | elif o in ("-s", "--strategy"): |
| 161 | 157 | self.strategy = p |
| 162 | 158 | else: | ... | ... |