Skip to main content

Parse an ebook based on its TOC into a tree-like structure

Project description

ebook-tree-parser

use ebooklib to parse a tree-like structure from ebooks from the TOC

Usage

from ebooklib import epub
from ebook_tree_parser.toctree import TocTree

file = "../data/frankenstein.epub"
book = epub.read_epub(file, options={'ignore_ncx': False})

estimator = lambda string: len(string)*4
tree = TocTree(book, token_estimator=estimator)

print(tree)

for node in tree3:
    print("----")
    print(f"{node.title}|{node.content_token_count}\n{node.content[:50]}")
    print("----")

Development

  1. Create a virtual environment
  2. pip install -e .
  3. Make sure to update pyproject.toml with the correct dependencies

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ebook_tree_parser-0.1.2.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

ebook_tree_parser-0.1.2-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file ebook_tree_parser-0.1.2.tar.gz.

File metadata

  • Download URL: ebook_tree_parser-0.1.2.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for ebook_tree_parser-0.1.2.tar.gz
Algorithm Hash digest
SHA256 866443cbb0c6331ec0eaa0078b7465ab1585fc472bcf839c5caba087da674bf9
MD5 28a26b126cbc1dd85963eb4f25064098
BLAKE2b-256 66dadd0c06c4323059d92f8b45c3162746ecbfac568c96e0b39675090c22cfc6

See more details on using hashes here.

File details

Details for the file ebook_tree_parser-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ebook_tree_parser-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 26643dd1443d34a927c9bfd503a15401afc2ee38f40379ed49fab334339ad970
MD5 f71273994873889742b22b742bbea3a8
BLAKE2b-256 4cdf21e4c5a0a31975fc09013443d5fb2892fe8581dd4c54ddec4bd097e9afab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page