(seq, n)
return [' '.join(ngram) for ngram in ngram_list]
Use python list comprehension to generate ngrams
Use python list comprehension to generate ngrams
Use python list comprehension to generate ngrams
def find_ngrams(seq, n):
  '''Use python list comprehension to generate ngrams'''
  ngram_list = [seq[i:i+n] for i in range(1+len(seq)-n)]
  return [' '.join(ngram) for ngram in ngram_list]
def find_ngrams ( seq , n ) : ngram_list = [ seq [ i : i + n ] for i in range ( 1 + len ( seq ) - n ) ] return [ ' ' . join ( ngram ) for ngram in ngram_list ]