class_docstr: An auxiliary class for storing the the words space.
class_docstr_tok: ["An","auxiliary","class","for","storing","the","the","words","space","."]
docstr: Construct a space class for the lexicon, if it's provided.
  
  Parameters
  ----------
  lang_vec : :class:`~gensim.models.keyedvectors.KeyedVectors`
      Model from which the vectors will be extracted.
  lexicon : list of str, optional
      Words which contains in the `lang_vec`, if `lexicon = None`, the lexicon is all the lang_vec's word.
  
  Returns
  -------
  :class:`~gensim.models.translation_matrix.Space`
      Object that stored word-vectors
docstr_tok: ["Construct","a","space","class","for","the","lexicon",",","if","it","'s","provided",".","Parameters","--","--","--","--","--","lang_vec",":",":","class",":","`","~gensim.models.keyedvectors.KeyedVectors","`","Model","from","which","the","vectors","will","be","extracted",".","lexicon",":","list","of","str",",","optional","Words","which","contains","in","the","`","lang_vec","`",",","if","`","lexicon","=","None","`",",","the","lexicon","is","all","the","lang_vec","'s","word",".","Returns","--","--","--","-",":","class",":","`","~gensim.models.translation_matrix.Space","`","Object","that","stored","word-vectors"]
code: def build(cls, lang_vec, lexicon=None):
      """Construct a space class for the lexicon, if it's provided.
  
      Parameters
      ----------
      lang_vec : :class:`~gensim.models.keyedvectors.KeyedVectors`
          Model from which the vectors will be extracted.
      lexicon : list of str, optional
          Words which contains in the `lang_vec`, if `lexicon = None`, the lexicon is all the lang_vec's word.
  
      Returns
      -------
      :class:`~gensim.models.translation_matrix.Space`
          Object that stored word-vectors
  
      """
      # `words` to store all the words
      # `mat` to store the word vector for each word in the 'words' list
      words = []
      mat = []
      if lexicon is not None:
          # if the lexicon is not provided, using all the Keyedvectors's words as default
          for item in lexicon:
              words.append(item)
              mat.append(lang_vec.vectors[lang_vec.get_index(item)])
  
      else:
          for item in lang_vec.index_to_key:
              words.append(item)
              mat.append(lang_vec.vectors[lang_vec.get_index(item)])
  
      return Space(mat, words)
  
imports: import warnings
  from collections import OrderedDict
  import numpy
  from gensim import utils
label_desc: Use image node_id 2 for calling the Space obj's underlying member method code with example usage: obj.build(cls, lang_vec, lexicon) and returns: Space