Skip to main content

Chunking utilities for GraphRAG

Project description

GraphRAG Chunking

This package contains a collection of text chunkers, a core config model, and a factory for acquiring instances.

Examples

Basic sentence chunking with nltk

The SentenceChunker class splits text into individual sentences by identifying sentence boundaries. It takes input text and returns a list where each element is a separate sentence, making it easy to process text at the sentence level.

Open the notebook to explore the basic sentence example code

Token chunking

The TokenChunker splits text into fixed-size chunks based on token count rather than sentence boundaries. It uses a tokenizer to encode text into tokens, then creates chunks of a specified size with configurable overlap between chunks.

Open the notebook to explore the token chunking example code

Using the factory via helper util

The create_chunker factory function provides a configuration-driven approach to instantiate chunkers by accepting a ChunkingConfig object that specifies the chunking strategy and parameters. This allows for more flexible and maintainable code by separating chunker configuration from direct instantiation.

Open the notebook to explore the factory helper util example code

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

graphrag_chunking-3.0.4.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

graphrag_chunking-3.0.4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file graphrag_chunking-3.0.4.tar.gz.

File metadata

  • Download URL: graphrag_chunking-3.0.4.tar.gz
  • Upload date:
  • Size: 7.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.17

File hashes

Hashes for graphrag_chunking-3.0.4.tar.gz
Algorithm Hash digest
SHA256 910830e48426300c1cc0f01af667924529778192275f7e3e5ee07138136b04f1
MD5 6eb6a43c319360ce6a4187463a0c42e7
BLAKE2b-256 340cbc3b2096b7fad93b5aaf540c76cd0f14fc084c2b9952e22b64ca5fc9f360

See more details on using hashes here.

File details

Details for the file graphrag_chunking-3.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for graphrag_chunking-3.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 f0bfc0069ccc5cf9c6cb839275d67b40ca4968245c6f6d35d4022437e6d08c8e
MD5 06526b9e09cebdf6b5e274a7d42078f0
BLAKE2b-256 e563517241d8423954fc4067a3fdbc8b0f26308a2a5c326c7156da2a7db1d95f

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