JS Text Chunker

Hierachical Vanilla JS logic for semantic text chunking. Change the chunk size for smaller or larger chunks. GitHub here. Please report bugs or improvement ideas.

  • Remove or add separators. Try this combo: ["\n\r", "\n", "\r", ".", "!", "?", ";", ":", "—", "–", "…", ",", " ", "\\\"","‘", "’", "“", "”", "(", ")", "[", "]", "{", "}", "/", "\\\\", ""]
  • Want to ignore line breaks? Use this: [".", "?", "!", ";", ",", ":", " ", ""]
Index Characters Chunk