code: def vocab_token_counts(text_filepattern, max_lines):
      """Read a vocab file and return a dictionary of token counts.
  
      Reads a two-column CSV file of tokens and their frequency in a dataset. The
      tokens are presumed to be generated by encode() or the equivalent.
  
      Args:
        text_filepattern: A pattern matching one or more files.
        max_lines: An integer; maximum total lines to read.
  
      Returns:
        a dictionary mapping token to count.
      """
      ret = {}
      for i, line in enumerate(
          _read_filepattern(text_filepattern, max_lines=max_lines)
      ):
          if "," not in line:
              logging.warning("Malformed vocab line #%d '%s'", i, line)
              continue
  
          token, count = line.rsplit(",", 1)
          ret[token] = int(count)
  
      return ret
  
file_path: trax/trax/data/tokenizer.py
imports: import collections
  import sys
  import unicodedata
  from absl import logging
  import six
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: vocab_token_counts(text_filepattern, max_lines) and returns: ret