Determines word frequency in a text document