changed bigrams function to ngrams