From 75de27a96394f87c834f0fbd842f281942026927 Mon Sep 17 00:00:00 2001 From: Tássia Camões Araújo Date: Mon, 27 Jun 2011 01:57:09 -0300 Subject: [PATCH] Added option for recommender weighting scheme and removed debtags_db options. --- src/config.py | 42 +++++++++++++++++++----------------------- 1 file changed, 19 insertions(+), 23 deletions(-) diff --git a/src/config.py b/src/config.py index 53b69f8..7e904ff 100644 --- a/src/config.py +++ b/src/config.py @@ -46,8 +46,8 @@ class Config(): self.popcon_index = "~/.app-recommender/popcon_index" self.popcon_dir = "~/.app-recommender/popcon_dir" self.clusters_dir = "~/.app-recommender/clusters_dir" - self.strategy = "cta" # defaults to the cheapest one - self.reindex = 0 + self.strategy = "cb" # defaults to the cheapest one + self.weight = "bm25" self.load_options() self.set_logger() @@ -63,22 +63,24 @@ class Config(): print " -c, --config=PATH Path to configuration file." print "" print " [ recommender ]" - print " -t, --tagsdb=PATH Path to debtags database." - print " -i, --tagsindex=PATH Path to debtags dedicated index." - print " -r, --force-reindex Force reindexing debtags database." print " -a, --axi=PATH Path to Apt-xapian-index." print " -p, --popconindex=PATH Path to popcon dedicated index." print " -m, --popcondir=PATH Path to popcon submissions dir." print " -l, --clustersdir=PATH Path to popcon clusters dir." + print " -w, --weight=OPTION Search weighting scheme." print " -s, --strategy=OPTION Recommendation strategy." print "" + print " [ weight options ] " + print " trad = traditional probabilistic weighting " + print " bm25 = bm25 weighting scheme " + print "" print " [ strategy options ] " - print " ct = content-based using tags " - print " cta = content-based using tags via apt-xapian-index" - print " cp = content-based using package descriptions " + print " cb = content-based " + print " cbt = content-based using only tags as content " + print " cbd = content-based using only package descriptions as content " print " col = collaborative " - print " colct = collaborative through tags content " - print " colcp = collaborative through package descriptions content " + #print " colct = collaborative through tags content " + #print " colcp = collaborative through package descriptions content " def read_option(self, section, option): """ @@ -108,19 +110,17 @@ class Config(): self.output_filename = self.read_option('general', 'output') self.config = self.read_option('general', 'config') - self.tags_db = self.read_option('recommender', 'tags_db') - self.tags_index = self.read_option('recommender', 'tags_index') - self.reindex = self.read_option('recommender', 'reindex') self.axi = self.read_option('recommender', 'axi') self.popcon_index = self.read_option('recommender', 'popcon_index') self.popcon_dir = self.read_option('recommender', 'popcon_dir') self.clusters_dir = self.read_option('recommender', 'clusters_dir') + self.weight = self.read_option('recommender', 'weight') + self.strategy = self.read_option('recommender', 'strategy') - short_options = "hdvo:c:t:i:ra:p:m:s:" + short_options = "hdvo:c:a:p:m:l:w:s:" long_options = ["help", "debug", "verbose", "output=", "config=", - "tagsdb=", "tagsindex=", "reindex", "axi=", - "popconindex=", "popcondir=", "clustersdir=", - "strategy="] + "axi=", "popconindex=", "popcondir=", "clustersdir=", + "weight=", "strategy="] try: opts, args = getopt.getopt(sys.argv[1:], short_options, long_options) @@ -142,12 +142,6 @@ class Config(): self.output = p elif o in ("-c", "--config"): self.config = p - elif o in ("-t", "--tagsdb"): - self.tags_db = p - elif o in ("-i", "--tagsindex"): - self.tags_index = p - elif o in ("-r", "--force-reindex"): - self.reindex = 1 elif o in ("-a", "--axi"): self.axi = p + "/index" self.axi_values = p + "/values" @@ -157,6 +151,8 @@ class Config(): self.popcon_dir = p elif o in ("-l", "--clustersdir"): self.popcon_dir = p + elif o in ("-w", "--weight"): + self.weight = p elif o in ("-s", "--strategy"): self.strategy = p else: -- libgit2 0.21.2