Live data from Hacker News

Show HN: Convert a number to an approximated text expression

github.com

1–10 of 32 posts

Re: Show HN: Convert a number to an approximated text expression

#3

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.

Re: Show HN: Convert a number to an approximated text expression

#4
If 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

#5

If 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

Re: Show HN: Convert a number to an approximated text expression

#7

Is there a Java version of this? I understand it's open-source, but since Clojure is JVM, and the lowest common denominator is Java, I think it will be hard to include Clojure just to use the library.

Clojure is JVM language and it is straightforward to interact with Clojure libs from Java apps. To make it even easier it is a first thing on my TODO list to provide a simple Java interface to work with Number Words plus update README with Java use examples.

Re: Show HN: Convert a number to an approximated text expression

#9
post #5

If 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

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
Post reply on HN