@chonkiejs/core

中文文档
0.0.12发布于 2026/10/04MITTypeScriptES Module构建来源已验证近 30 天下载 10.8万

Core chunking library for Chonkie - lightweight and efficient text chunking

原始使用文档
文档目录7 节
  1. Features
  2. Installation
  3. Quick Start
  4. Available Chunkers
  5. Contributing
  6. Acknowledgements
  7. Citation

Chonkie Logo

@chonkiejs/core

Core chunking library for Chonkie - lightweight and efficient text chunking with zero dependencies.

npm version npm license Documentation GitHub

Features

✨ Simple & Clean API - Easy to use OOP design
⚡ Zero Dependencies - Minimal, lightweight, fast
🔤 Character-based - Simple tokenization (1 char = 1 token)
🎯 Recursive Chunking - Smart hierarchical text splitting
📦 TypeScript First - Full type safety with TypeScript

Installation

Install with npm:

npm i @chonkiejs/core

Install with pnpm:

pnpm add @chonkiejs/core

Install with yarn:

yarn add @chonkiejs/core

Install with bun:

bun add @chonkiejs/core

Quick Start

import { RecursiveChunker } from '@chonkiejs/core';

// Create a chunker
const chunker = await RecursiveChunker.create({
  chunkSize: 512,
  minCharactersPerChunk: 24
});

// Chunk your text
const chunks = await chunker.chunk('Your text here...');

// Use the chunks
for (const chunk of chunks) {
  console.log(chunk.text);
  console.log(`Tokens: ${chunk.tokenCount}`);
}

Available Chunkers

NameDescription
RecursiveChunkerRecursively splits text using hierarchical rules (paragraphs → sentences → punctuation → words → characters). Each level only activates if chunks exceed the configured size.
TokenChunkerSplits text into fixed-size token chunks with optional overlap. Uses character-based tokenization by default, or HuggingFace models with @chonkiejs/token.
TableChunkerSplits Markdown or HTML tables into smaller table chunks while repeating the original header in each chunk. Supports row-based and token-based modes.
FastChunkerUses byte-based boundary detection through @chonkiejs/chunk for very fast chunking with delimiter or pattern controls.

For detailed API documentation, configuration options, and advanced usage, see DOCS.md.

Contributing

Want to help grow Chonkie? Check out CONTRIBUTING.md to get started! Whether you're fixing bugs, adding features, improving docs, or simply leaving a ⭐️ on the repo, every contribution helps make Chonkie a better CHONK for everyone.

Remember: No contribution is too small for this tiny hippo!

Acknowledgements

Chonkie would like to CHONK its way through a special thanks to all the users and contributors who have helped make this library what it is today! Your feedback, issue reports, and improvements have helped make Chonkie the CHONKIEST it can be.

And of course, special thanks to Moto Moto for endorsing Chonkie with his famous quote:

"I like them big, I like them chonkie in TypeScript" ~ Moto Moto... definitely did not say this

Citation

If you use Chonkie in your research, please cite it as follows:

@software{chonkie2025,
  author = {Bhavnick Minhas and Shreyash Nigam},
  title = {Chonkie: A no-nonsense fast, lightweight, and efficient text chunking library},
  year = {2025},
  publisher = {GitHub},
  howpublished = {\url{https://github.com/chonkie-inc}},
}

版本与发布记录

@chonkiejs/core 共发布 10 个版本,首次发布于 2025/10/08;过去 12 个月发布了 6 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.0.12latest2026/10/041 个月前
0.0.112026/06/194 个月前
0.0.102026/05/135 个月前
0.0.92026/03/287 个月前
0.0.82026/03/137 个月前
0.0.72026/01/219 个月前

关于 @chonkiejs/core 的常见问题

@chonkiejs/core 是什么?

Core chunking library for Chonkie - lightweight and efficient text chunking

如何安装 @chonkiejs/core?

在项目目录运行 npm install @chonkiejs/core,或使用 pnpm add / yarn add / bun add。

@chonkiejs/core 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@chonkiejs/core 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@chonkiejs/core 可以商用吗?

@chonkiejs/core 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@chonkiejs/core 的下载量有多少?

根据 npm 官方下载统计,@chonkiejs/core 在 2026/10/10 – 2026/11/08 这 30 天内被下载 108,049 次,日均约 3,602 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@chonkiejs/core 还在维护吗?

最新版本 0.0.12 发布于 2026/10/04(1 个月前);至今共发布 10 个版本,其中过去 12 个月发布了 6 个;首次发布于 2025/10/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。