Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RagBites

Basic text-chunking strategies for RAG.

Python 3.10+ JavaScript deps: none demo: GitHub Pages

Live demo →

Key features

  • Basic chunking strategies
    Fixed-size character, character + overlap, fixed-size word, greedy word, sentence, paragraph, and recursive.
  • Interactive visualizer
    Paste any text, tune each method's parameters with per-card sliders, and watch the chunks update live.
  • Zero dependencies
    Python stdlib only; the web app is a single static page that deploys anywhere.

The 7 strategies

# Function Splits by
1 basic_chunk a fixed number of characters
2 overlap_chunks characters, with overlap between chunks
3 word_chunks a fixed number of words
4 greedy_word_chunks words, greedily filled up to a char budget
5 sentence_chunks whole sentences
6 paragraph_chunks blank-line paragraphs
7 recursive_chunks the largest separator first, recursing down

Usage

Try it online: https://januaryofmine.github.io/rag-bites/

Run the visualizer locally (Python stdlib, no install):

git clone https://github.com/januaryofmine/rag-bites
cd rag-bites
python -m http.server 8000   # -> http://127.0.0.1:8000

Use the chunkers directly in Python:

import chunk

text = "Your document text..."
print(chunk.recursive_chunks(text, max_chars=150))

Files

File Role
chunk.py the 7 chunkers, pure Python (reference)
chunk.js 1:1 JS port that powers the static demo
index.html the visualizer UI
app.py original Python /api/chunk server (kept for reference)

About

Basic chunking strategies for RAG

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages