parameters: (sentences)
return_statement: return [vocabulary, vocabulary_inv]
docstring: Builds a vocabulary mapping from word to index based on the sentences.
      Returns vocabulary mapping and inverse vocabulary mapping.
docstring_summary: Builds a vocabulary mapping from word to index based on the sentences.
      Returns vocabulary mapping and inverse vocabulary mapping.
docstring_tokens: Builds a vocabulary mapping from word to index based on the sentences . Returns vocabulary mapping and inverse vocabulary mapping .
function: def build_vocab(sentences):
      """Builds a vocabulary mapping from word to index based on the sentences.
      Returns vocabulary mapping and inverse vocabulary mapping.
      """
      # Build vocabulary
      word_counts = Counter(itertools.chain(*sentences))
      # Mapping from index to word
      vocabulary_inv = [x[0] for x in word_counts.most_common()]
      # Mapping from word to index
      vocabulary = {x: i for i, x in enumerate(vocabulary_inv)}
      return [vocabulary, vocabulary_inv]
function_tokens: def build_vocab ( sentences ) : # Build vocabulary word_counts = Counter ( itertools . chain ( * sentences ) ) # Mapping from index to word vocabulary_inv = [ x [ 0 ] for x in word_counts . most_common ( ) ] # Mapping from word to index vocabulary = { x : i for i , x in enumerate ( vocabulary_inv ) } return [ vocabulary , vocabulary_inv ]