Skip to content

Commit

Permalink
Merge branch 'pr/5' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
umarbutler committed Jun 1, 2024
2 parents f6854f3 + a8a7ab2 commit db552f9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/semchunk/semchunk.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def merge_splits(splits: list[str], chunk_size: int, splitter: str, token_counte

tokens = token_counter(splitter.join(splits[:midpoint]))

average = cumulative_lengths[midpoint] / tokens if cumulative_lengths[midpoint] else average
average = cumulative_lengths[midpoint] / tokens if cumulative_lengths[midpoint] and tokens > 0 else average

if tokens > chunk_size:
high = midpoint
Expand Down Expand Up @@ -256,4 +256,4 @@ def chunker(text_or_texts: str | Sequence[str]) -> list[str] | list[list[str]]:

return [chunk(text, chunk_size, token_counter, memoize = False) for text in text_or_texts]

return chunker
return chunker

0 comments on commit db552f9

Please sign in to comment.