Hello all, I am creating a skill to access TMDb. All is going well, but I would like to be able for mycroft to say a large number, such as 7500000, as seven-hundred and fifty million instead of 7 5 0 0 0 0 0.
I have tried to use nice_number, but it doesn’t seem to be working the way I thought it should.
My skill is at GitHub - builderjer/moviemaster: Gets information from tmdb
Any advice would be great.
Thank you
1 Like
from mycroft.util import pronounce_number
"two point nine nine times ten to the power of eight")
self.assertEqual(pronounce_number(299792458, places=6,
scientific=True),
"two point nine nine seven nine two five times "
"ten to the power of eight")
self.assertEqual(pronounce_number(1.672e-27, places=3,
scientific=True),
"one point six seven two times ten to the power of "
"negative twenty seven")
def test_large_numbers(self):
self.assertEqual(
pronounce_number(299792458, short_scale=True),
"two hundred and ninety nine million, seven hundred "
"and ninety two thousand, four hundred and fifty eight")
self.assertEqual(
pronounce_number(299792458, short_scale=False),
"two hundred and ninety nine million, seven hundred "
"and ninety two thousand, four hundred and fifty eight")
self.assertEqual(
pronounce_number(100034000000299792458, short_scale=True),
2 Likes
Thank you @JarbasAl . I found that and it works as expected.
2 Likes