code: def compute_n_words_and_types(
      words: Iterable[Token],
  ) -> tuple[int, int]:
      """
      Compute the number of words and the number of unique words (aka types).
  
      Args:
          words: Sequence of non-punct, non-space tokens -- "words" -- as output, say,
              by :func:`get_words()`.
  
      Returns:
          (n_words, n_types)
      """
      word_counts = itertoolz.frequencies(word.lower for word in words)
      return (sum(word_counts.values()), len(word_counts))
  
file_path: textacy/src/textacy/text_stats/utils.py
imports: import functools
  import logging
  from typing import Iterable
  import pyphen
  from cachetools import cached
  from cachetools.keys import hashkey
  from spacy.tokens import Token
  from toolz import itertoolz
  from ..None import cache, types
label_desc: Use image node_id 2 for calling a global function with example usage: compute_n_words_and_types(words) and returns: sum,  len