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).
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
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
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.
> Water temperature is below 10C (input data would be 9.53C)
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.
Given GP's "...whether the author wants to emphasize..." I don't think an algorithm could choose without knowing the author's intent. There's so much context and subtlety in choosing words based on intent.
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.
I always assumed their system is simply to tell you roughly whether to expect the person to be online soonish. And I would find it too invading to have exact numbers - e.g. in WhatsApp almost everyone I know disables that.
It tells you the exact time anyway, just have to click on it (or otherwise get to the contact's profile). The options for disabling it are to make it visible to everybody/contacts/nobody.
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.
It has nothing to do with open-source. This project is written in Java (basically), which is proprietary.
It has everything to do with programming languages that don't compile down to linker symbols that can be called with the C calling convention, and the utter failure of Unix philosophy when it comes to shell tools.
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.
For Python, for English, there is the inflect library: https://pypi.org/project/inflect/