chunk-match

A NodeJS library that semantically chunks text and matches it against a user query using cosine similarity for precise and relevant text retrieval.

A Node.js library that semantically chunks text and matches it against a user query using cosine similarity for relevant text retrieval. It returns chunks sorted by relevance with similarity scores, and exposes configurable similarity thresholds and chunk sizes. It is built on top of semantic-chunking for the underlying text processing and supports various ONNX embedding models. The main matchChunks(documents, query, options) function takes an array of document objects, a query string, and options such as maxResults, minSimilarity, and detailed chunkingOptions.

Installation

npm install chunk-match