code: def make_vocab(
      filenames,
      max_vocab_size=-1,
      newline_token=None,
      return_type="list",
      return_count=False,
  ):
      """Builds vocab of the files.
  
      Args:
          filenames (str): A (list of) files.
          max_vocab_size (int): Maximum size of the vocabulary. Low frequency
              words that exceeding the limit will be discarded.
              Set to `-1` (default) if no truncation is wanted.
          newline_token (str, optional): The token to replace the original newline
              token "\\\\n". For example,
              `newline_token=tx.data.SpecialTokens.EOS`.
              If `None`, no replacement is performed.
          return_type (str): Either "list" or "dict". If "list" (default), this
              function returns a list of words sorted by frequency. If "dict",
              this function returns a dict mapping words to their index sorted
              by frequency.
          return_count (bool): Whether to return word counts. If `True` and
              :attr:`return_type` is "dict", then a count dict is returned, which
              is a mapping from words to their frequency.
  
      Returns:
          - If :attr:`return_count` is False, returns a list or dict containing \
          the vocabulary words.
  
          - If :attr:`return_count` if True, returns a pair of list or dict \
          `(a, b)`, where `a` is a list or dict containing the vocabulary \
          words, `b` is a list of dict containing the word counts.
      """
      if not isinstance(filenames, (list, tuple)):
          filenames = [filenames]
  
      words = []
      for fn in filenames:
          words += read_words(fn, newline_token=newline_token)
  
      counter = collections.Counter(words)
      count_pairs = sorted(counter.items(), key=lambda x: (-x[1], x[0]))
  
      words, counts = list(zip(*count_pairs))
      if max_vocab_size >= 0:
          words = words[:max_vocab_size]
          counts = counts[:max_vocab_size]
  
      if return_type == "list":
          if not return_count:
              return words
          else:
              return words, counts
      elif return_type == "dict":
          word_to_id = dict(zip(words, range(len(words))))
          if not return_count:
              return word_to_id
          else:
              word_to_count = dict(zip(words, counts))
              return word_to_id, word_to_count
      else:
          raise ValueError(
              "Unknown return_type: {}".format(return_type)
          )
  
file_path: texar/texar/tf/data/data_utils.py
imports: import os
  import sys
  import tarfile
  import zipfile
  import collections
  import numpy
  from six.moves import urllib
  import requests
  import tensorflow
  from texar.tf.utils import utils_io
label_desc: Use image node_id 6 for calling a global function with example usage: make_vocab(filenames, max_vocab_size, newline_token, return_type, return_count) and returns: words, words,  counts, word_to_id, word_to_id,  word_to_count