(
    text_filepattern, corpus_max_lines, split_on_newlines=True)
return counts
Read the corpus and compute a dictionary of token counts.

  Args:
    text_filepattern: A pattern matching one or more files.
    corpus_max_lines: An integer; maximum total lines to read.
    split_on_newlines: A boolean. If true, then split files by lines and strip
        leading and trailing whitespace from each line. Otherwise, treat each
        file as a single string.

  Returns:
    a dictionary mapping token to count.
Read the corpus and compute a dictionary of token counts.
Read the corpus and compute a dictionary of token counts .
def corpus_token_counts(
    text_filepattern, corpus_max_lines, split_on_newlines=True):
  """Read the corpus and compute a dictionary of token counts.

  Args:
    text_filepattern: A pattern matching one or more files.
    corpus_max_lines: An integer; maximum total lines to read.
    split_on_newlines: A boolean. If true, then split files by lines and strip
        leading and trailing whitespace from each line. Otherwise, treat each
        file as a single string.

  Returns:
    a dictionary mapping token to count.
  """
  counts = collections.Counter()
  for doc in _read_filepattern(
      text_filepattern,
      max_lines=corpus_max_lines,
      split_on_newlines=split_on_newlines):
    counts.update(encode(doc))

  return counts
def corpus_token_counts ( text_filepattern , corpus_max_lines , split_on_newlines = True ) : counts = collections . Counter ( ) for doc in _read_filepattern ( text_filepattern , max_lines = corpus_max_lines , split_on_newlines = split_on_newlines ) : counts . update ( encode ( doc ) ) return counts