def compute_similarity(job): """Return a tuple containing: (query, filename, similarity, semantic similarity, word order similarity) calling dmmgmain.similarity(). """ sim, sem, wos = similarity(job[1][0], job[1][1], job[1][2]) return (job[1][1], job[1][2], sim, sem, wos)
help="Path to the database root") nltk_updater() args = parser.parse_args() if args.delta: delta = args.delta else: delta = None if args.client: client.start() elif args.server: server.start((delta, args.query, args.rootpath)) else: if os.path.isfile(args.rootpath): similarity(delta, args.query, args.rootpath) elif os.path.isdir(args.rootpath) and os.path.isfile(args.query): for filepath in filepath_gen(args.rootpath): similarity(delta, args.query, filepath) elif os.path.isdir(args.rootpath) and os.path.isdir(args.query): queryset, testset = server.file_manager(args.query, args.rootpath) for query_filepath in queryset: try: testset.remove(query_filepath) except KeyError: pass for test_filepath in testset: similarity(delta, query_filepath, test_filepath) else: sys.stderr.write('Provide a valid path.\n') exit(1)