@classmethod<EOL><INDENT>def load(cls, path, vocab=None, dtype=np.float32, max_vocab=None,<EOL>format=None, binary=False):<DEDENT>
freqs = None<EOL>if vocab is not None:<EOL><INDENT>with open(vocab, mode='<STR_LIT:rb>') as f:<EOL><INDENT>freqs = loader.vocab.load_vocab(f)<EOL><DEDENT>vocab = {k: i for i, (k, v) in enumerate(<EOL>sorted(six.iteritems(freqs),<EOL>key=lambda k_v: k_v[<NUM_LIT:1>], reverse=True)[:max_vocab])}<EOL><DEDENT>with open(path, mode='<STR_LIT:rb>') as f:<EOL><INDENT>if format is None:<EOL><INDENT>mod = classify_format(f)<EOL><DEDENT>else:<EOL><INDENT>mod = _select_module(format, binary)<EOL><DEDENT><DEDENT>with open(path, mode='<STR_LIT:rb>') as f:<EOL><INDENT>if vocab is not None:<EOL><INDENT>arr = mod.loader.load_with_vocab(f, vocab, dtype=dtype)<EOL>v = vocab<EOL><DEDENT>else:<EOL><INDENT>arr, v = mod.loader.load(f, max_vocab=max_vocab, dtype=dtype)<EOL><DEDENT><DEDENT>obj = cls(arr, v, freqs)<EOL>obj._load_cond = mod<EOL>return obj<EOL>
Load pretrained word embedding from a file.

Args:
    path (str): Path of file to load.
    vocab (str or None): Path to vocabulary file created by word2vec
        with ``-save-vocab <file>`` option. If vocab is given,
        :py:attr:`~vectors` and :py:attr:`~vocab` is ordered in
        descending order of frequency.
    dtype (numpy.dtype): Element data type to use for the array.
    max_vocab (int): Number of vocabulary to read.
    format (str or None): Format of the file. ``'word2vec'`` for file
        that was implemented in
        `word2vec <https://code.google.com/archive/p/word2vec/>`_,
        by Mikolov et al.. ``'glove'`` for file that was implemented in
        `GloVe <https://nlp.stanford.edu/projects/glove/>`_, Global
        Vectors for Word Representation, by Jeffrey Pennington,
        Richard Socher, Christopher D. Manning from Stanford NLP group.
        If ``None`` is given, the format is guessed from the content.
    binary (bool): Load file as binary file as in word embedding file
        created by
        `word2vec <https://code.google.com/archive/p/word2vec/>`_ with
        ``-binary 1`` option. If ``format`` is ``'glove'`` or ``None``,
        this argument is simply ignored

Returns:
    :class:`~word_embedding_loader.word_embedding.WordEmbedding`