def sentence_to_ngram(sentence, max_n=1):
    """ transform sentence to ngram list

    Args:
        sentence: sentence to be transformed
        max_n: max_n for ngram

    Returns:
        list: ngram list

    """
    words = sentence.split()
    ngrams = list()
    for n in range(1, max_n + 1):  # add ngram
        for i in range(0, len(words) - n + 1):
            ngrams.append(' '.join(words[i:i + n]))
    return ngrams