some refactoring and generator of edge ngram terms has been updated