code: def n_chars_per_word(
      doc_or_tokens: types.DocOrTokens,
  ) -> tuple[int, ...]:
      """
      Compute the number of characters for each word 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.
  
      Note:
          This function is cached, since other functions rely upon its outputs
          to compute theirs. As such, ``doc_or_tokens`` must be hashable -- for example,
          it may be a ``Doc`` or ``tuple[Token, ...]`` , but not a ``List[Token]`` .
      """
      words = utils.get_words(doc_or_tokens)
      return tuple(len(word) for word in words)
  
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 4 for calling a global function with example usage: n_chars_per_word(doc_or_tokens) and returns: tuple