예제 #1
0
파일: brandeis.py 프로젝트: molly/brandeis
    except NoCaseInList as e:
        choice = input(e.value + ' Continue? (y/n)')
        if choice == 'y' or choice == "Y":
            logger.info(e.value + " Continuing.")
        else:
            logger.info(e.value + " Skipping.")
            continue
    except MultipleCases as e:
        choice = input(e.value + ' Continue? (y/n)')
        if choice == 'y' or choice == "Y":
            logger.info(e.value + " Continuing.")
        else:
            logger.info(e.value + " Skipping.")
            continue
    else:
        if api.case_exists(line):
#             choice = input(metadict['title'] + ' exists on Wikisource. Continue? (y/n)')
#             if choice == 'n' or choice == "N":
            logger.info(metadict['title'] + " exists on Wikisource. Skipping.")
            continue
#             else:
#                 logger.info(metadict['title'] + " exists on Wikisource. Continuing.")
    
    # At this point, we have a valid text file for a case that does not exist on Wikisource
    logger.info("Parsing {0}.".format(metadict['title']))
    tokenizer = Tokenizer(metadict)
    parser = Parser(metadict)
    try:
        os.mkdir('wikitext')
    except OSError:
        pass