Commit 5011c245f1dbb62ba77f1390b626427e2086fb36
1 parent
dfcac4b1
Exists in
master
and in
1 other branch
Updated config options.
Showing
1 changed file
with
10 additions
and
5 deletions
Show diff stats
src/config.py
| @@ -44,7 +44,8 @@ class Config(): | @@ -44,7 +44,8 @@ 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.index_mode = "0" # use old index | 47 | + self.k_medoids = 100 |
| 48 | + self.index_mode = "old" | ||
| 48 | self.strategy = "cb" | 49 | self.strategy = "cb" |
| 49 | self.weight = "bm25" | 50 | self.weight = "bm25" |
| 50 | self.load_options() | 51 | self.load_options() |
| @@ -65,8 +66,9 @@ class Config(): | @@ -65,8 +66,9 @@ class Config(): | ||
| 65 | print " -a, --axi=PATH Path to Apt-xapian-index" | 66 | print " -a, --axi=PATH Path to Apt-xapian-index" |
| 66 | print " -p, --popconindex=PATH Path to popcon dedicated index" | 67 | print " -p, --popconindex=PATH Path to popcon dedicated index" |
| 67 | print " -m, --popcondir=PATH Path to popcon submissions dir" | 68 | print " -m, --popcondir=PATH Path to popcon submissions dir" |
| 68 | - print " -u, --index_mode= 0: old, 1:reindex, 11:clustered_index" | 69 | + print " -u, --indexmode= old, reindex, cluster, recluster" |
| 69 | print " -l, --clustersdir=PATH Path to popcon clusters dir" | 70 | print " -l, --clustersdir=PATH Path to popcon clusters dir" |
| 71 | + print " -e, --medoids=k Number of medoids for clustering" | ||
| 70 | print " -w, --weight=OPTION Search weighting scheme" | 72 | print " -w, --weight=OPTION Search weighting scheme" |
| 71 | print " -s, --strategy=OPTION Recommendation strategy" | 73 | print " -s, --strategy=OPTION Recommendation strategy" |
| 72 | print "" | 74 | print "" |
| @@ -115,13 +117,14 @@ class Config(): | @@ -115,13 +117,14 @@ class Config(): | ||
| 115 | self.popcon_dir = self.read_option('recommender', 'popcon_dir') | 117 | self.popcon_dir = self.read_option('recommender', 'popcon_dir') |
| 116 | self.index_mode = self.read_option('recommender', 'index_mode') | 118 | self.index_mode = self.read_option('recommender', 'index_mode') |
| 117 | self.clusters_dir = self.read_option('recommender', 'clusters_dir') | 119 | self.clusters_dir = self.read_option('recommender', 'clusters_dir') |
| 120 | + self.k_medoids = self.read_option('recommender', 'k_medoids') | ||
| 118 | self.weight = self.read_option('recommender', 'weight') | 121 | self.weight = self.read_option('recommender', 'weight') |
| 119 | self.strategy = self.read_option('recommender', 'strategy') | 122 | self.strategy = self.read_option('recommender', 'strategy') |
| 120 | 123 | ||
| 121 | - short_options = "hdvo:c:a:p:m:ul:w:s:" | 124 | + short_options = "hdvo:c:a:p:m:ul:e:w:s:" |
| 122 | long_options = ["help", "debug", "verbose", "output=", "config=", | 125 | long_options = ["help", "debug", "verbose", "output=", "config=", |
| 123 | - "axi=", "popconindex=", "popcondir=", "index_mode=", | ||
| 124 | - "clusters_dir=", "weight=", "strategy="] | 126 | + "axi=", "popconindex=", "popcondir=", "indexmode=", |
| 127 | + "clustersdir=", "kmedoids=", "weight=", "strategy="] | ||
| 125 | try: | 128 | try: |
| 126 | opts, args = getopt.getopt(sys.argv[1:], short_options, | 129 | opts, args = getopt.getopt(sys.argv[1:], short_options, |
| 127 | long_options) | 130 | long_options) |
| @@ -154,6 +157,8 @@ class Config(): | @@ -154,6 +157,8 @@ class Config(): | ||
| 154 | self.index_mode = p | 157 | self.index_mode = p |
| 155 | elif o in ("-l", "--clustersdir"): | 158 | elif o in ("-l", "--clustersdir"): |
| 156 | self.clusters_dir = p | 159 | self.clusters_dir = p |
| 160 | + elif o in ("-e", "--kmedoids"): | ||
| 161 | + self.k_medoids = p | ||
| 157 | elif o in ("-w", "--weight"): | 162 | elif o in ("-w", "--weight"): |
| 158 | self.weight = p | 163 | self.weight = p |
| 159 | elif o in ("-s", "--strategy"): | 164 | elif o in ("-s", "--strategy"): |