Make wordOccurrences and sentenceOccurrences functions