One other aspect of approximated numbers is whether the author wants to emphasize that the number is large or small. "Less than" and "almost" carry different connotations.
You are right, hence Number Words returns different versions of the approximation: 'more', 'less' and 'around'. More nuanced versions could be added to the list. Importantly the choice of the approximation version to use would be with the user of the library. Wonder if the algorithm to choose appropriate approximation can be devised.
Show HN: Convert a number to an approximated text expression
11–20 of 32 posts
Re: Show HN: Convert a number to an approximated text expression
#12One other aspect of approximated numbers is whether the author wants to emphasize that the number is large or small. "Less than" and "almost" carry different connotations.
You are right, hence Number Words returns different versions of the approximation: 'more', 'less' and 'around'. More nuanced versions could be added to the list. Importantly the choice of the approximation version to use would be with the user of the library. Wonder if the algorithm to choose appropriate approximation can be devised.
I can't tell the water temperature at all without context -- could be any temperature below 10C; and in the wrong context it could be confusing. "Just below"/"just under" would be a lot more accurate.
Re: Show HN: Convert a number to an approximated text expression
#13One other aspect of approximated numbers is whether the author wants to emphasize that the number is large or small. "Less than" and "almost" carry different connotations.
Re: Show HN: Convert a number to an approximated text expression
#14Earlier 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
It's 8.8MB of plaintext English output describing the ridiculously long number, for those on mobile (who can't see the full file), or who don't want to click through the 'file is truncated...' link
Re: Show HN: Convert a number to an approximated text expression
#15If 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/
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
Aside, this is why French style punctuation with a space before ? or ! is superior.
Re: Show HN: Convert a number to an approximated text expression
#16Re: Show HN: Convert a number to an approximated text expression
#17If 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/
Re: Show HN: Convert a number to an approximated text expression
#18Earlier 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" !
Re: Show HN: Convert a number to an approximated text expression
#19If 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/
CL-USER> (format t "~r" 4096)
four thousand ninety-sixRe: Show HN: Convert a number to an approximated text expression
#20If 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/
For Common Lisp, there's a FORMAT directive: CL-USER> (format t "~r" 4096) four thousand ninety-six