def load(fin, dtype=np.float32, max_vocab=None):
vocab = {}<EOL>arr = None<EOL>i = <NUM_LIT:0><EOL>for line in fin:<EOL><INDENT>if max_vocab is not None and i >= max_vocab:<EOL><INDENT>break<EOL><DEDENT>try:<EOL><INDENT>token, v = _parse_line(line, dtype)<EOL><DEDENT>except (ValueError, IndexError):<EOL><INDENT>raise ParseError(b'<STR_LIT>' + line)<EOL><DEDENT>if token in vocab:<EOL><INDENT>parse_warn(b'<STR_LIT>' + token)<EOL>continue<EOL><DEDENT>if arr is None:<EOL><INDENT>arr = np.array(v, dtype=dtype).reshape(<NUM_LIT:1>, -<NUM_LIT:1>)<EOL><DEDENT>else:<EOL><INDENT>if arr.shape[<NUM_LIT:1>] != len(v):<EOL><INDENT>raise ParseError(b'<STR_LIT>' + line)<EOL><DEDENT>arr = np.append(arr, [v], axis=<NUM_LIT:0>)<EOL><DEDENT>vocab[token] = i<EOL>i += <NUM_LIT:1><EOL><DEDENT>return arr, vocab<EOL>
Load word embedding file.

Args:
    fin (File): File object to read. File should be open for reading ascii.
    dtype (numpy.dtype): Element data type to use for the array.
    max_vocab (int): Number of vocabulary to read.

Returns:
    numpy.ndarray: Word embedding representation vectors
    dict: Mapping from words to vector indices.