Added helper functions for calculating tfidf values

May need to update based on data from database.