Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Divide by zero error #4

Closed
jcobol opened this issue May 27, 2024 · 1 comment
Closed

Divide by zero error #4

jcobol opened this issue May 27, 2024 · 1 comment

Comments

@jcobol
Copy link
Contributor

jcobol commented May 27, 2024

It is possible for a token counter to return zero tokens, leading to a division by zero error in the merge_splits function:

  File "C:\Users\user\miniconda3\envs\project\Lib\site-packages\semchunk\semchunk.py", line 78, in merge_splits
    average = cumulative_lengths[midpoint] / tokens if cumulative_lengths[midpoint] else average
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
ZeroDivisionError: division by zero
jcobol added a commit to jcobol/semchunk that referenced this issue May 27, 2024
@umarbutler
Copy link
Owner

Thanks for this! This bug is now fixed in v0.3.2 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants