def ngrams(words, n):
    """

    Note:
        generate ngrams of certain length with a list of word

    Args:
        words: words list
        n: length of ngram

    Returns:
        list of ngrams of certain length

    """
    if len(words)<= n:
        print (len(words), '/',n)
        return words
    else:
        ngram_set = set()
        for i in range(len(words)-n+1):
            ngram_set.add(' '.join(words[i:i+n]))
        return list(ngram_set)