Earlier quoted context omitted.
Use automation to get human-friendly text for numbers. An example from the readme: - Q2 sales were around 1M$ When the input was $1,002,184.
I'd be amazed if a company put "around $1M" for anything that was "over $1M" !
Show HN: Convert a number to an approximated text expression
21–30 of 32 posts
Re: Show HN: Convert a number to an approximated text expression
#22I wish Telegram used such a thing. Someone not seen for 1h59m is 'last seen an hour ago'. Even just showing the actual time would be more helpful IMO - it displays it at the top right underneath (iOS) or very near (Android) the system time anyway, I don't know why it's thought to be a good idea to remove so much information.
Re: Show HN: Convert a number to an approximated text expression
#23Re: Show HN: Convert a number to an approximated text expression
#24If you don't want it approximate, but exact, this is still a tricky non-trivial ambiguous problem. And this problem often comes up in text normalization for NLP task (e.g. speech recognition, or text-to-speech). For Python, for English, there is the inflect library: https://pypi.org/project/inflect/
Lots of fun edge cases to handle.
Re: Show HN: Convert a number to an approximated text expression
#25This is the type of thing WASM modules would be perfect for. Theres no reason for this to have so many implementations in so many languages.
In the old days you would have a binary shell tool or a dll, and then you could call it from any language. It did not matter in which language the tool was written in.
Re: Show HN: Convert a number to an approximated text expression
#26Earlier quoted context omitted.
I also wrote a function in Pascal to convert integers to natural language exactly. E.g. here is the output for 100000! https://gist.github.com/benibela/f0163b02562f647e4d2f
Isn't "one hundred thousand factorial" a more useful conversion? Would your conversion ever find utility? Aside, this is why French style punctuation with a space before ? or ! is superior.
I am implementing the XPath standard. The standard says there need to be a function to convert integers to English, but it does not specify an upper limit on the integers
Re: Show HN: Convert a number to an approximated text expression
#27Earlier quoted context omitted.
Isn't "one hundred thousand factorial" a more useful conversion? Would your conversion ever find utility? Aside, this is why French style punctuation with a space before ? or ! is superior.
I did not write it to be useful. I just wanted to say it can handle large integers. I am implementing the XPath standard. The standard says there need to be a function to convert integers to English, but it does not specify an upper limit on the integers
Out of curiosity, what part of the spec does that implement? Is it to do with fn:format-integer.
Re: Show HN: Convert a number to an approximated text expression
#28Does this exist for time numbers? I wish Telegram used such a thing. Someone not seen for 1h59m is 'last seen an hour ago'. Even just showing the actual time would be more helpful IMO - it displays it at the top right underneath (iOS) or very near (Android) the system time anyway, I don't know why it's thought to be a good idea to remove so much information.
Re: Show HN: Convert a number to an approximated text expression
#29Earlier quoted context omitted.
I did not write it to be useful. I just wanted to say it can handle large integers. I am implementing the XPath standard. The standard says there need to be a function to convert integers to English, but it does not specify an upper limit on the integers
Cool, IMO that makes it potentially useful (but being useful isn't required of course). Out of curiosity, what part of the spec does that implement? Is it to do with fn:format-integer.
Number formatting is really complicated
Re: Show HN: Convert a number to an approximated text expression
#30Does this exist for time numbers? I wish Telegram used such a thing. Someone not seen for 1h59m is 'last seen an hour ago'. Even just showing the actual time would be more helpful IMO - it displays it at the top right underneath (iOS) or very near (Android) the system time anyway, I don't know why it's thought to be a good idea to remove so much information.