Initial implementation of computeWordFrequencies