def load_vocab(vocab_file):
vocab = collections.OrderedDict()<EOL>index = <NUM_LIT:0><EOL>with io.open(vocab_file, '<STR_LIT:r>') as reader:<EOL><INDENT>while True:<EOL><INDENT>token = reader.readline()<EOL>if not token:<EOL><INDENT>break<EOL><DEDENT>token = token.strip()<EOL>vocab[token] = index<EOL>index += <NUM_LIT:1><EOL><DEDENT><DEDENT>return vocab<EOL>
Loads a vocabulary file into a dictionary.