Skip to main content

Universal chunking functions to extract LLM-friendly chunks from any file type.

Project description

Unichunking

Extract LLM-friendly chunks from any file type.

Supported file types are :

  • DOCX & DOCX-like (DOC, ODT)
  • PPTX & PPTX-like (PPT, ODP)
  • XLSX & XLSX-like (XLS, ODS)
  • TXT, MD, CSV
  • IPYNB

Installation

To install, run the following command:

python3 -m pip install delos-unichunking

How to use

The main functions are :

  • extract_subchunks returns a list of all the text particles in the file.
  • split_chunks_with_overlap transforms a list of subchunks on a given page into a list of chunks following default or specified parameters for minimum/maximum token size and overlap.
  • build_chunked_pages returns a list of "pages", which are lists of formated chunks, following the structure of the document.
  • compute_pages approximates the pagination of a file that does not have a native pagination system (such as DOCX) by comparing it to a PDF version.

Specificities

Please note that the package requires a LibreOffice installation to run soffice commands, used during file conversions : for instance, DOC/ODT are first converted to DOCX format and processed as such.

The page numbers computed for DOCX files are an approximation and can be off by a few pages for large files.

Artifical page numbers are used for page-less structures such as TXT files, or to split large XLSX sheets into multiple pages, to follow a tokens-per-page limit.

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

delos_unichunking-0.8.15.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

delos_unichunking-0.8.15-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file delos_unichunking-0.8.15.tar.gz.

File metadata

  • Download URL: delos_unichunking-0.8.15.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for delos_unichunking-0.8.15.tar.gz
Algorithm Hash digest
SHA256 9cde82253f9f23a038d34d8be039a8f4e3fbb153170f0a504ee3431201ebf411
MD5 e99543f24e8229b2f81d93d751cd0634
BLAKE2b-256 a3337d047f4778ef6e2ee8b877ea2c0467990a4657e41d680673fdbb5ed56188

See more details on using hashes here.

File details

Details for the file delos_unichunking-0.8.15-py3-none-any.whl.

File metadata

File hashes

Hashes for delos_unichunking-0.8.15-py3-none-any.whl
Algorithm Hash digest
SHA256 6a0a1b08465fcfde74a11984c499e9eb2148a058c9d8f795f1afa6df1b188414
MD5 7d142dbd51ae1aff8e8af4f692f8382b
BLAKE2b-256 001008f6899b5fc4f16075b1b053b81b7946332fdec88742c6abda8e5f5ed6c3

See more details on using hashes here.

Supported by

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