adding wordfrequency function