diff --git a/cognee/tasks/chunks/chunk_by_paragraph.py b/cognee/tasks/chunks/chunk_by_paragraph.py index 1668276c5..f71c4372b 100644 --- a/cognee/tasks/chunks/chunk_by_paragraph.py +++ b/cognee/tasks/chunks/chunk_by_paragraph.py @@ -31,7 +31,7 @@ def chunk_by_paragraph( current_chunk = "" chunk_index = 0 paragraph_ids = [] - last_cut_type = None + last_cut_type = "default" current_chunk_size = 0 for paragraph_id, sentence, sentence_size, end_type in chunk_by_sentence( @@ -77,6 +77,9 @@ def chunk_by_paragraph( current_chunk_size = 0 chunk_index += 1 + if not end_type: + end_type = "default" + last_cut_type = end_type # Yield any remaining text