To build this algorithm, it's important to recognizing the pattern of spelling words for some numbers.
212 => two hundred twelve
345867 => three hundred forty five thousand eight hundred sixty seven
By those numbers and the translation in words, It could conclude that :
- there is some exceptions in the pattern
ex : 10 => ten not onety
12 => twelve not ten two
20 => twenty not twoty
by this conclution the dictionary (knowledge) to build have to give the knowledgement about those exceptions
- there id repetition pattern in word "hundred" before and after "thousand". For that reason, it could simplify to devide the algorithm that translate 3 digits numbers from the global algorithm that translate x digits numbers.