adding old codes - ngram based probabilisitic inference