construct stemmed corpus with word ids