0.0
The project is in a healthy, maintained state
SemanticChunks splits Markdown and plain text into token-budgeted chunks with overlap, headings, offsets, and metadata without Python dependencies.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
 Project Readme

SemanticChunks

SemanticChunks is a pure Ruby text chunker for RAG, search indexing, and LLM apps.

It solves a common Ruby AI problem: document preparation often gets pushed to Python just to split text into useful chunks. This gem keeps that step in Ruby.

Install

gem install semantic_chunks

Usage

require "semantic_chunks"

chunks = SemanticChunks.split(markdown, max_tokens: 300, overlap: 40)

chunks.each do |chunk|
  puts chunk.text
  p chunk.metadata
end

Each chunk includes:

  • text
  • index
  • token_count
  • char_start
  • char_end
  • headings
  • metadata

CLI

semantic-chunks README.md --max-tokens 300 --overlap 40

Outputs JSON.

Why

Ruby has excellent web frameworks and backend tooling, but a lot of AI utility work still assumes Python. SemanticChunks gives Ruby apps a native, predictable chunking layer before embeddings, vector search, or LLM calls.