added code to generate the ngram set