code: def n_long_words(
      doc_or_tokens: types.DocOrTokens, *, min_n_chars: int = 7
  ) -> int:
      """
      Compute the number of long words in a document.
  
      Args:
          doc_or_tokens: If a spaCy ``Doc``, non-punctuation tokens (words) are extracted;
              if an iterable of spaCy ``Token`` s, all non-punct elements are used.
          min_n_chars: Minimum number of characters required for a word to be
              considered "long".
      """
      # docs are hashable, so we can leverage the lru cache as-is
      if isinstance(doc_or_tokens, Doc):
          ncpw = n_chars_per_word(doc_or_tokens)
      # otherwise, let's get an iterable of words but cast it to a hashable tuple
      # so we can leverage the lru cache on this and related calls in, say, n_long_words
      else:
          words = utils.get_words(doc_or_tokens)
          ncpw = n_chars_per_word(tuple(words))
      return itertoolz.count(nc for nc in ncpw if nc >= min_n_chars)
  
imports: from __future__ import annotations
  import functools
  import logging
  import math
  from typing import Optional
  import spacy.pipeline
  from cytoolz import itertoolz
  from spacy.tokens import Doc
  from ..None import types
  from .None import utils
label_desc: Use image node_id 6 for calling a global function with example usage: n_long_words(doc_or_tokens) and returns: itertoolz