frequency computation for nlp