Your n_gram_creator works fine how you have it, but here is another way to write it using a foreach loop in case you want to take a look:
def ngram_creator(text_list):
ngrams = []
lastword = None
for word in text_list:
if lastword:
ngrams.append('{} {}'.format(lastword, word))
lastword = word
return ngrams
Your n_gram_creator works fine how you have it, but here is another way to write it using a foreach loop in case you want to take a look: