def get_vocabulary(dataset, min_word_count=0):
    """
    Filter out words in the questions that are <= min_word_count and create a vocabulary from the filtered words
    :param dataset: The VQA dataset
    :param min_word_count: The minimum number of counts the word needs in order to be included
    :return:
    """
    counts = {}
    print("Calculating word counts in questions")
    for d in dataset:
        for w in d["question_tokens"]:
            counts[w] = counts.get(w, 0) + 1

    vocab = [w for w, n in counts.items() if n > min_word_count]

    # cw = sorted([(n, w) for w, n in counts.items() if n > min_word_count], reverse=True)
    # print('\n'.join(map(str, cw[:20])))

    # Add the 'UNK' token
    vocab.append('UNK')  # UNK has it's own ID

    return vocab