def load(fin, dtype=np.float32, max_vocab=None):
vocab = {}<EOL>line = next(fin)<EOL>data = line.strip().split(b'<STR_LIT:U+0020>')<EOL>assert len(data) == <NUM_LIT:2><EOL>words = int(data[<NUM_LIT:0>])<EOL>if max_vocab is not None:<EOL><INDENT>words = min(max_vocab, words)<EOL><DEDENT>size = int(data[<NUM_LIT:1>])<EOL>arr = np.empty((words, size), dtype=dtype)<EOL>i = <NUM_LIT:0><EOL>for n_line, line in enumerate(fin):<EOL><INDENT>if i >= words:<EOL><INDENT>break<EOL><DEDENT>token, v = _load_line(line, dtype, size)<EOL>if token in vocab:<EOL><INDENT>parse_warn(b'<STR_LIT>' + token)<EOL>continue<EOL><DEDENT>arr[i, :] = v<EOL>vocab[token] = i<EOL>i += <NUM_LIT:1><EOL><DEDENT>if i != words:<EOL><INDENT>parse_warn(<EOL>b'<STR_LIT>' + bytes(i) + b'<STR_LIT>'<EOL>+ bytes(words) + b'<STR_LIT:)>'<EOL>)<EOL>arr = arr[:i, :]<EOL><DEDENT>return arr, vocab<EOL>
Refer to :func:`word_embedding_loader.loader.glove.load` for the API.