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

Unexpected Fraction Parsing #32

Open
eric1234 opened this issue Jan 23, 2025 · 0 comments
Open

Unexpected Fraction Parsing #32

eric1234 opened this issue Jan 23, 2025 · 0 comments

Comments

@eric1234
Copy link

Unexpected:

NumbersInWords.in_numbers("three and a half")  # => 15.5

Weird maybe it's something with a three not being understood since it got the half right.

NumbersInWords.in_numbers("four and a half")  # => 20.5

Nope that is not it. But just a half works:

NumbersInWords.in_numbers("half") #  => 0.5

Must be the filler words:

NumbersInWords.in_numbers("a half") #  => 0.5
NumbersInWords.in_numbers("and a half")   # => 0.5

Not without half:

NumbersInWords.in_numbers("three and")   #   => 3
NumbersInWords.in_numbers("three and a")   #  => 31

Ah, now we are getting somewhere. So it's getting 31 then multiplying it by 0.5 to get 15.5? Maybe related to a?. Let's try taking the a out:

NumbersInWords.in_numbers("three and half")   # => 1.5

Well, now it's not getting 31 but still multiplying by 0.5 instead of appending. This leads me to the questions:

So the parsing looks intentional and not a bug. So maybe the text I'm trying to give it is just not supported?

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

1 participant