From 9ea26344809b36e35881112815416ab46c4aad8b Mon Sep 17 00:00:00 2001 From: Leon Luithlen Date: Wed, 13 Nov 2024 15:53:44 +0100 Subject: [PATCH] Replace word_count with maximum_length in if clause --- cognee/tasks/chunks/chunk_by_sentence.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cognee/tasks/chunks/chunk_by_sentence.py b/cognee/tasks/chunks/chunk_by_sentence.py index 1ce052a6c..2bf1bf8ee 100644 --- a/cognee/tasks/chunks/chunk_by_sentence.py +++ b/cognee/tasks/chunks/chunk_by_sentence.py @@ -15,7 +15,7 @@ def chunk_by_sentence(data: str, maximum_length: Optional[int] = None): sentence += word word_count += 1 - if word_type == "paragraph_end" or word_type == "sentence_end" or ((word_count is not None) and (word_count == maximum_length)): + if word_type == "paragraph_end" or word_type == "sentence_end" or ((maximum_length is not None) and (word_count == maximum_length)): yield (paragraph_id, chunk_index, sentence, word_count, word_type) sentence = "" word_count = 0