def everygrams(sequence, min_len=1, max_len=(-1), **kwargs):
 if (max_len == (-1)):
  max_len = len(sequence)
 for n in range(min_len, (max_len + 1)):
  for ng in ngrams(sequence, n, **kwargs):
   (yield ng)

def everygrams ( sequence , min_len = 1 , max_len = ( - 1 ) , ** kwargs ) : if ( max_len == ( - 1 ) ) : max_len = len ( sequence ) for n in range ( min_len , ( max_len + 1 ) ) : for ng in ngrams ( sequence , n , ** kwargs ) : ( yield ng )
returns all possible ngrams generated from a sequence of items .