I tried a perl script versus the shell pipeline, see my other comments in the thread. It's significantly faster, because using sort and uniq -c is a pretty high effort way to count words, especially for big lists. Your words seem to work fine with it, it's just splitting on whitespace.
However if you want to extend the program from a toy to something that can handle words like "won't" "c-code" "a.i." or "naïve" then it will be quite difficult to do so.