code: def count_words(iterable) -> collections.Counter:
      """Converts a iterable of arrays of words into a `Counter` of word counts."""
      counts = collections.Counter()
      for words in iterable:
          # Convert a RaggedTensor to a flat/dense Tensor.
          words = getattr(words, "flat_values", words)
          # Flatten any dense tensor
          words = np.reshape(words, [-1])
          counts.update(words)
  
      # Decode the words if necessary.
      example_word = next(iter(counts.keys()))
      if isinstance(example_word, bytes):
          counts = collections.Counter(
              {
                  word.decode("utf-8"): count
                  for word, count in counts.items()
              }
          )
  
      return counts
  
file_path: text/tensorflow_text/tools/wordpiece_vocab/wordpiece_tokenizer_learner_lib.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  from typing import List, Optional
  import numpy
label_desc: Use image node_id 11 for calling a global function with example usage: count_words(iterable) and returns: counts