matching the mouth shape of an audio file(lip sync)
The simplest solution I can think of is to use an envelope follower, the higher the amplitude, the more open the mouth is. This is pretty simple but will one give tell you how 'open' the mouth should be, not the shape. This should already be quite effective for a cartoon. To make it more realistic you should probably try to detect vowels (Oh and Ah for instance) by measuring the formants. http://en.wikipedia.org/wiki/Formant gives a list of average frequency's for some vowels. Of course these are only average, so you need to experiment.

I don't think you need to recognize exactly which words are spoken, this will be much more complex, and there are quite a lot of words in each language, and quite a lot of languages... :-)

If you add consonant detection as well, you probably have all the information you need...