code: def from_corpus(cls, corpus):
      w2i = {}
      for sent in corpus:
          for word in sent:
              w2i.setdefault(word, len(w2i))
      return Vocab(w2i)
  
file_path: dynet/examples/python-utils/util.py
imports: import mmap
label_desc: Use image node_id 2 for calling the Vocab obj's underlying member method code with example usage: obj.from_corpus(cls, corpus) and returns: Vocab