def build_dict(word_count, min_count):
    """Construct dictionaries about words' id and frequency.

    Args:
        word_count: list, with element like (word, count)
        min_count: int, minimum number of word occurrences
    Returns:
        2 dictionary that map word to id, id to word, respectively.
    """
    word2id = dict()
    id2word = dict()
    wid = 0  # word id
    for word, cnt in word_count:
        if cnt < min_count:  # delete word which is seldom used
            continue
        word2id[word] = wid
        id2word[wid] = word
        wid += 1
    return word2id, id2word