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

Bug: Throws NumOutOfRangeError for numbers longer than 36 digits #20

Open
torond opened this issue Jun 1, 2021 · 2 comments
Open

Bug: Throws NumOutOfRangeError for numbers longer than 36 digits #20

torond opened this issue Jun 1, 2021 · 2 comments

Comments

@torond
Copy link

torond commented Jun 1, 2021

A NumOutOfRangeError is thrown when numbers longer than 36 digits are converted.
This makes the system prone to break, when the input text is unknown.

To reproduce:

>>> from g2p_en import G2p
>>> g2p_en = G2p()
>>> g2p_en('999999999999999999999999999999999999')  # This works
['N', 'AY1', 'N', ' ', 'HH', 'AH1', 'N', ...]
>>> g2p_en('1000000000000000000000000000000000000')  # This doesn't
...
inflect.NumOutOfRangeError

This error stems from the inspect.py module, which isn't part of this projects source code.
Workaround: Remove numbers longer than 36 digits instead of transforming them to words. This would lose some edge case information but is the only way to keep the transcribed output clean.

@divyanx
Copy link

divyanx commented Aug 19, 2021

I also encountered this problem, just figured out a walk around.
For numbers bigger than those supported can just make to pronounce each digit instead of the whole place value system. This will be a bit in hand with what we do with large numbers.

@torond
Copy link
Author

torond commented Aug 19, 2021

That would also be a justified solution.
Although it might add a lot of information and increase the noise of the output.
Especially if the author did not intend the numbers to be read out loud.

I don't recall how floating point numbers are transcribed (e.g. 0.2348719). They should definitely be transcribed digit-by-digit.

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