LaTeX document word statistics

What I'm after is a way to perform simple statistics on a LaTeX document. This is, instead of just grouping all words and counting its length, I'd like to count the number of instances of each word separately.