Skip to main content

chunkit

PyPI version Downloads License: GPL v3

Turn URLs into LLM-friendly markdown chunks

Chunkit allows you to scrape and convert webpages into markdown chunks, for RAG applications.

Quickstart

  1. Install
pip install chunkit
  1. Start chunking
from chunkit import Chunker

# Initialize the Chunker
chunker = Chunker()

# Define URLs to process
urls = ["https://en.wikipedia.org/wiki/Chunking_(psychology)"]

# Process the URLs into markdown chunks
chunkified_urls = chunker.process(urls)

# Output the resulting chunks
for url in chunkified_urls:
    if url['success']:
        for chunk in url['chunks']:
            print(chunk)
Example results for above Wikipedia page

Chunk 1

### Chunking (psychology)

In cognitive psychology, **chunking** is a process by which small individual pieces of a set of information are bound together to create a meaningful whole later on in memory. The chunks, by which the information is grouped, are meant to improve short-term retention of the material, thus bypassing the limited capacity of working memory...

Chunk 2

### Modality effect

A modality effect is present in chunking. That is, the mechanism used to convey the list of items to the individual affects how much "chunking" occurs. Experimentally, it has been found that auditory presentation results in a larger amount of grouping in the responses of individuals than visual presentation does...

Chunk 3

### Memory training systems, mnemonic

Various kinds of memory training systems and mnemonics include training and drills in specially-designed recoding or chunking schemes. Such systems existed before Miller's paper, but there was no convenient term to describe the general strategy and no substantive and reliable research...

Etc.

How most chunkers work

Most chunkers:

  • Perform a naive chunking based on the number of words in the content.
  • For example, they may split content every 200 words, and have a 30 word overlap between each.
  • This leads to messy chunks that are noisy and have unnecessary extra data.
  • Additionally, the chunked sentences are usually split in the middle, with lost meaning.
  • This leads to poor LLM performance, with incorrect answers and hallucinations.

Why Chunkit works better

Chunkit however, converts HTML to Markdown, and then determines split points based on the most common header levels.

This gives you better results because:

  • Online content tends to be logically split in paragraphs delimited by headers.
  • By chunking based on headers, this method preserves semantic meaning better.
  • You get a much cleaner, semantically cohesive paragraph of data.

Supported filetypes

This free open source package primarily chunks webpages and html.

License

This project is licensed under GPL v3 - see the LICENSE file for details.

Contact

For questions or support, please open an issue.

Release files for chunkit 0.2.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for chunkit 0.2.9
File Interpreter ABI Platform
chunkit-0.2.9-py3-none-any.whl Python 3 none any Details

Release files / chunkit-0.2.9-py3-none-any.whl

Download URL chunkit-0.2.9-py3-none-any.whl
Size 17.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9ee11932870137ba4d88a17e519a14a44a62a57a8d8bf4a7c980f6f635b79a4
BLAKE2b-256 checksum
How to use checksums
6f32c8dc73c8ca21eac9f1747973cb2609393d0fe90b2a23c4f0935921cd29ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.9 This release

1 release file

0.2.8

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page