a method that gets the frequency of a word in a string.