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

normalize_number fails on exponent / fractional input #848

Closed
evanmiller-anthropic opened this issue Nov 14, 2024 · 1 comment · Fixed by #891
Closed

normalize_number fails on exponent / fractional input #848

evanmiller-anthropic opened this issue Nov 14, 2024 · 1 comment · Fixed by #891

Comments

@evanmiller-anthropic
Copy link
Contributor

With input such as , this conditional returns true:

if number.replace(".", "").isnumeric():

but the next line fails with ValueError: could not convert string to float: '1²'

num = float(number)

@jjallaire
Copy link
Collaborator

Thanks for reporting! This PR should handle it: #891

Although after implementing it did occur to me that another resolution would have been to just use a different isnumeric test (i.e. simply don't handle the case of ). My bias would be to handle it (since obviously a model produced it in your testing!) but I at least wanted to ask the question before merging. LMK what you think.

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

Successfully merging a pull request may close this issue.

2 participants