Add word frequency statistic function