I do contract work for a living, which could include writing a program such as this. However, I don’t do people’s homework for them. That just robs them of an education.
You have my full permission to implement this project any way you please.
Have a look at The Learn To Count Applet, particularly the source code. It contains code to count out in words in various languages.
I wrote the class for each language by getting a set of example numbers and words from a native speaker or a phrasebook or by sampling Internet posts, e.g. 21 == "vingt et un" in French, and deducing the rules for converting numbers to words and writing the code. I would then print out a set of sample numbers using the rules (selecting the samples to ensure I cover all the rule variants), and check them with a native speaker. He would then give me some more examples to explain the exceptions to the rules he had forgotten about previously. I would then convert those exceptions into rules, code them, and go round again until the native speaker was happy. Sometimes the native speaker would tell me the rules directly. Usually, these were less useful and less ambiguous than two or three examples.
I discovered there were various patterns in the rules. Different languages had various combinations of the standard patterns.
The process was fairly easy, quite mechanical, and allowed for a fair bit of trial and error rather than demanding brute reasoning.
Could you automate the task of writing code for additional languages?
Could you write a program that, just shown some counting examples from a foreign language, could compose a program to generate all the longs out in words? The answer is yes, you could write such a program, no problem, though it would be "cheating ". It would just require a bit of patience to manually write the code for each human written language, then recognize it, and cough up the previously optimised code when handed a set of examples in that language.
What we want is something a little cleverer, that could work on a language it had never seen before, but that was a human language. Again you could cheat, in a lesser way this time, my simply cataloging all features of counting in all written human languages, writing custom code to recognize each feature, and cranking out code by turning on or off pieces of preformed boilerplate.
One way to attack the problem is to ask yourself, "How could I rapidly generate, generalise and optimise the cheating solution?" Another is, how could I solve the simpler problem of just handling the 20 or so languages the Learn To Count Applet already knows, or some subset of them.
So think of it as a contest. You will be handed a Java class, that will accept a long positive or negative and will return you a String for the corresponding number in words in the target language. Your program will then, by probing the class for examples, and making inferences, construct a program that reproduces the one inside the black box to convert numbers to words for the unknown language inside the class.
You get points for:
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.18] | The information on this page is for non-military use only. | ||
| You are visitor number 6,596. | Military use includes use by defence contractors. | ||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/project/ai.html | J:\mindprod\project\ai.html | ||