write some utility function for nlp