Added term frequency calculations and output to files.