From 84c98f16bb9501118dc856d7d7d83f3dc8ccefcd Mon Sep 17 00:00:00 2001 From: Leon Luithlen Date: Thu, 14 Nov 2024 16:49:13 +0100 Subject: [PATCH] Remove chunk_index attribute from chunk_by_sentence return value --- cognee/tasks/chunks/chunk_by_sentence.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cognee/tasks/chunks/chunk_by_sentence.py b/cognee/tasks/chunks/chunk_by_sentence.py index fedc0c9b2..bee074d04 100644 --- a/cognee/tasks/chunks/chunk_by_sentence.py +++ b/cognee/tasks/chunks/chunk_by_sentence.py @@ -8,7 +8,6 @@ from .chunk_by_word import chunk_by_word def chunk_by_sentence(data: str, maximum_length: Optional[int] = None): sentence = "" paragraph_id = uuid4() - chunk_index = 0 word_count = 0 section_end = False @@ -28,16 +27,14 @@ def chunk_by_sentence(data: str, maximum_length: Optional[int] = None): break if word_type in ["paragraph_end", "sentence_end"] or (maximum_length and (word_count == maximum_length)): - yield (paragraph_id, chunk_index, sentence, word_count, word_type) + yield (paragraph_id, sentence, word_count, word_type) sentence = "" word_count = 0 paragraph_id = uuid4() if word_type == "paragraph_end" else paragraph_id - chunk_index = 0 if word_type == "paragraph_end" else chunk_index + 1 if len(sentence) > 0: yield ( paragraph_id, - chunk_index, sentence, word_count, section_end,