Commit c490e149577c78481ae850c53066f889103e4f0c
1 parent
f3bda937
Exists in
master
and in
1 other branch
Added script to index popcon data.
Showing
1 changed file
with
51 additions
and
0 deletions
Show diff stats
... | ... | @@ -0,0 +1,51 @@ |
1 | +#!/usr/bin/env python | |
2 | +""" | |
3 | + Clustering - A python script to perform clustering of popcon data. | |
4 | +""" | |
5 | +__author__ = "Tassia Camoes Araujo <tassia@gmail.com>" | |
6 | +__copyright__ = "Copyright (C) 2011 Tassia Camoes Araujo" | |
7 | +__license__ = """ | |
8 | + This program is free software: you can redistribute it and/or modify | |
9 | + it under the terms of the GNU General Public License as published by | |
10 | + the Free Software Foundation, either version 3 of the License, or | |
11 | + (at your option) any later version. | |
12 | + | |
13 | + This program is distributed in the hope that it will be useful, | |
14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + GNU General Public License for more details. | |
17 | + | |
18 | + You should have received a copy of the GNU General Public License | |
19 | + along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 | +""" | |
21 | +import os | |
22 | +import sys | |
23 | +sys.path.insert(0,'../') | |
24 | +import logging | |
25 | +import datetime | |
26 | +from datetime import timedelta | |
27 | + | |
28 | +from config import * | |
29 | +from data import * | |
30 | +from dissimilarity import * | |
31 | +from error import Error | |
32 | + | |
33 | +if __name__ == '__main__': | |
34 | + try: | |
35 | + cfg = Config() | |
36 | + begin_time = datetime.datetime.now() | |
37 | + logging.info("Popcon indexing started at %s" % begin_time) | |
38 | + | |
39 | + pxi = PopconXapianIndex(cfg) | |
40 | + | |
41 | + end_time = datetime.datetime.now() | |
42 | + logging.info("Popcon indexing completed at %s" % end_time) | |
43 | + delta = end_time - begin_time | |
44 | + logging.info("Time elapsed: %d seconds." % delta.seconds) | |
45 | + if cfg.index_mode=="cluster" or cfg.index_mode=="recluster": | |
46 | + logging.info("Medoids: %d\tDispersion:%f" % | |
47 | + (cfg.k_medoids,pxi.cluster_dispersion)) | |
48 | + | |
49 | + except Error: | |
50 | + logging.critical("Aborting proccess. Use '--debug' for more details.") | |
51 | + | ... | ... |