Skip to content

Commit

Permalink
Fix chunk size bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Moeki Kawakami committed Jun 15, 2023
1 parent 58c2658 commit ecd0302
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/baran/text_splitter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def merged(splits, separator)
if total + split.length >= chunk_size && current_splits.length.positive?
results << joined(current_splits, separator)

while total > chunk_overlap || (total + split.length > chunk_size && total.positive?)
while total > chunk_overlap || (total + split.length >= chunk_size && total.positive?)
total -= current_splits.first.length
current_splits.shift
end
Expand Down

0 comments on commit ecd0302

Please sign in to comment.