Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
split.ts 358 B
import fs from "node:fs/promises";

import { SentenceSplitter } from "llamaindex";

async function main() {
  const path = "node_modules/llamaindex/examples/abramov.txt";
  const essay = await fs.readFile(path, "utf-8");

  const textSplitter = new SentenceSplitter();

  const chunks = textSplitter.splitText(essay);

  console.log(chunks);
}

void main();