added n_grams function