From bd777ed02cfdd281215b7b23ed3bad9fd6a1b574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B0=D1=82=20=D0=A4=D0=B0=D0=B7=D1=8B?= =?UTF-8?q?=D0=BB=D0=BE=D0=B2?= Date: Fri, 15 May 2026 08:39:58 +0000 Subject: [PATCH] add chunker --- chunker.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 chunker.py diff --git a/chunker.py b/chunker.py new file mode 100644 index 0000000..974a8a0 --- /dev/null +++ b/chunker.py @@ -0,0 +1,12 @@ +from langchain_text_splitter import RecursiveCharacterTextSplitter + +def get_chunks(content, title): + splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200) + texts = splitter.split_text(content) + return [ + { + "page_content": t, + "metadata": {"title": title} + } + for t in texts + ]