write a method to find word frequency