Exemplo n.º 1
0
def file_manager(query_path, test_path):
    queryset = Set([])
    testset = Set([])
    for query_filepath in filepath_gen(query_path):
        queryset.add(query_filepath)
    for test_filepath in filepath_gen(test_path):
        testset.add(test_filepath)
    return queryset, testset
Exemplo n.º 2
0
    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)