code to generate text corpus, build dictionary and Dat file