Grammar for counting in Chinese (for non-native speakers of Chinese) I need to write a program that can insert the count of objects into a text - without knowing virtually anything about the Chinese language. While for English this needs to distinguish between singular and plural, I don't know which special cases need to be handled for Chinese. Using an online translator to translate "one house, ..., thirteen houses", I obtained


  一所房子，两个房屋、 三栋房子、 四个房屋、 五之家、 六套房子、 七个之家、 八个公司、 九个房屋、 十家、 十一间房屋、 12 间房、 十三个房子.


The same with cats:


  一只猫，两只猫、 三只猫，四只猫、 五只猫、 六只猫、 七只猫、 八猫、 九猫、 十猫、 11 个猫、 十二个猫，十三个猫


Some of this may be caused by imperfections of the online translator used, but I wonder if some of the patterns should be observed by my program. And I need to provide it with suitably many "declination" forms to allow it to create the correct output:


Arabic digits for 12 in the first test and 11 in the second test are obviously an artefact of the online translator. I assume that it is never customary to use arabic numbers in Chinese?
I wonder why "two" seems to be translated by 两 instead of 二. Is that correct? Or does it depend on something?
What follows the numeral seems to differ depending on the number. For example I see 所房子 with 1; 个房屋 with 2, 4, 9; 栋房子 with 3; and all remaining numbers seem to have their very individual signs, at least when it is about  "houses". For the cats I see 只猫 with 1-7, 猫 with 8-10, 个猫 with 11-13. While this looks less complicated, I wonder: Are the different forms required by grammar? Do they follow a specific pattern (e.g. for living versus dead things)? Which variants have to be used for which number? (Or is this just another translator artefact?)


Thanks for any hints on this, but please remember to keep them understandable for someone who knows no Chinese and will handle Chinese texts with a mere "pattern substitution" technique.
Regarding arabic numerals: I think modern usage sees arabic numbers to be generally acceptable. However the context of the material, or even the region, may influence whether they're commonly used or not. For example, in metropolitan areas you might commonly see phone numbers or prices expressed in digits, whereas in more traditional material you probably wouldn't. You may or may not be able to get away with this in your project.

Regarding 两 vs 二: 两 is generally used as "two" for specifying a number of objects, whereas 二 is used as the digit, such as in a phone number. See this question for more on this distinction.

Regarding the classifier: As far as I'm aware, there's no such rule as 1-6 uses this classifier, 7-9 uses this, etc. The classifier is determined by the noun. In your example, the classifier for cats (猫） is 只. For house (房子) you can use 栋.

The classifier for people is (usually) 个. Perhaps more importantly, 个 can be used as the catch-all classifier in casual language, or when an obscure noun has a classifier that you simply cannot remember. Again, whether you can use this "shortcut" will depend on the specifications of your project. In more formal situations, the correct classifier is preferred.

If you have a finite list of nouns in your project, you could spend some time looking up the relevant classifier for each noun.

http://www.mdbg.net/chindict/chindict.php specifies the classifier in the dictionary entries, denoted by the "CL:" text.

Hope that helps!