(vocab_file, threshold)
return vocabulary
read vocabulary file produced by get_vocab.py, and filter according to frequency threshold.
read vocabulary file produced by get_vocab.py, and filter according to frequency threshold.
read vocabulary file produced by get_vocab . py and filter according to frequency threshold .
def read_vocabulary(vocab_file, threshold):
    """read vocabulary file produced by get_vocab.py, and filter according to frequency threshold.
    """

    vocabulary = set()

    for line in vocab_file:
        word, freq = line.split()
        freq = int(freq)
        if threshold == None or freq >= threshold:
            vocabulary.add(word)

    return vocabulary
def read_vocabulary ( vocab_file , threshold ) : vocabulary = set ( ) for line in vocab_file : word , freq = line . split ( ) freq = int ( freq ) if threshold == None or freq >= threshold : vocabulary . add ( word ) return vocabulary