def test_epub_stemming():
    book = EPUBTranslation("resources/DonQuijote.epub")
    assert len(book.get_chapter(25).get(10)) == 10
예제 #2
0
                  default=False)
parser.add_option("-o", "--ordered",
                  action="store_true",
                  dest="ordered",
                  help="flag to order by most common",
                  default=False)
parser.add_option("-s", "--start",
                  action="store",
                  dest="start",
                  type="int",
                  help="starting point",
                  default=0)

(options, args) = parser.parse_args()
if options.filename is not None:
    book = EPUBTranslation(options.filename)
    if options.chapter is None:
        print("Imported {0}, please select which chapter to read".format(book.title))

        for index, item in enumerate(book.chapters):
            print("{0}. {1}".format(index, item.get_name()))
    else:
        chapter = book.get_chapter(options.chapter)
        words = []
        types = []

        if options.verbs is True:
            types.append("v")
        elif options.nouns is True:
            types.append("n")
        words = chapter.get(options.quantity, start=options.start, types=types, ordered=options.ordered,