Ngram based string regeneration