converting words to ids for clustering.