import collections


def filter_words(line, count):
    """ Filter words in documents less than count. """
    cnt = collections.Counter()
    for sentence in line:
        cnt.update(sentence)

    s = set(word for word in cnt if cnt[word] < count)
    l_temp = [[word for word in sentence if word not in s] for sentence in line]
    return l_temp