def main(argv=None):
    run_opts = parse_options()
    swt_conv.import_analize_modules()
    cluster.import_analize_modules()
    
    tf = swt_template.TemplateFinder();
    for i in range(len(run_opts["templates"])):
        etb = swt_template.ExtremumTemplate()
        etb.load(run_opts["templates"][i])
        tf.add_template(etb)
        
    for i in range(len(run_opts["check_files"])):
        print "Analizing", run_opts["check_files"][i], "..."
        tf.analize_file(run_opts["check_files"][i])
        template_x = tf.get_template_x()
        print type(template_x)
        keys = []
        for k in template_x.keys():
            template_x[k].sort()
            keys.append(k)
        print template_x
        for k in keys:    
            print k,":", tf.get_cluster_groups(k)
            
        tf.print_hit_count()
def main(argv=None):
    run_opts = parse_options()
    
    import_analize_modules()
    swt_conv.import_analize_modules()
    cluster.import_analize_modules()
    
    for i in range(len(run_opts["files"])):
        fsb = FsmBuilder(run_opts["files"][i])
        fsb.build()
        fsb.create_tcl(run_opts["folders"][i])
        fsb.create_xml(run_opts["folders"][i])
def main(argv=None):
    run_opts = parse_options()
    swt_conv.import_analize_modules()
    cluster.import_analize_modules()
    
    tf = swt_template.TemplateFinder()
    tb = TemplateBuilder(run_opts["ref_file"])
    etb = tb.build(run_opts["name"])
    tf.add_template(etb)
    for i in range(len(run_opts["files"])):
        tf.analize_file(run_opts["files"][i])
        tf.recalculate_probabilities()
        
    etb.save(run_opts["template"])