No matter what programs are you using, you can do it in only one way: by having a big dictionary which indicates some grammar and semantic categories in each article. The word itself carries no information on what is it. Moreover, before reading the information from the article, you need first classify each word as a noun or not, or with a dictionary, you need to decide which of the possible
homonyms (
http://en.wikipedia.org/wiki/Homonym[
^]) should be considered. This is often impossible without analysis of the context (which is, in turn, a very difficult problem which is not solved with satisfactory quality on the present level of computer science and technology), and cannot be solves at all for certain texts. For example, the use of homonyms is typical for wordplay, so the final resolution of the meaning of the word by a human reader may be not even assumed.
You did not explain which languages do you mean, but for certain language the category of countability does not even exist or classification of nouns into countable and non-countable cannot be built or makes no sense.
Overall, the question does not make a whole lot of sense and not essentially related to Lex or Yacc.
—SA