code: def get_pattern_matching_candidates(
      doc: Doc,
      patterns: str | list[str] | list[dict] | list[list[dict]],
  ) -> Iterable[tuple[Token, ...]]:
      """
      Get candidate keyterms from ``doc``, where candidates are sequences of tokens
      that match any pattern in ``patterns``
  
      Args:
          doc
          patterns: One or multiple patterns to match against ``doc`` using
              a :class:`spacy.matcher.Matcher`.
  
      Yields:
          tuple[:class:`spacy.tokens.Token`]: Next pattern-matching candidate,
          as a tuple of constituent Tokens.
  
      See Also:
          :func:`textacy.extract.token_matches()`
      """
      for match in matches.token_matches(doc, patterns, on_match=None):
          yield tuple(match)
  
file_path: textacy/src/textacy/extract/utils.py
imports: from __future__ import annotations
  import itertools
  import operator
  import re
  from typing import Callable, Collection, Iterable, Optional
  from cytoolz import itertoolz
  from spacy.tokens import Doc, Token
  from ..None import constants, errors, types, utils
  from .None import matches
label_desc: Use image node_id 6 for calling a global function with example usage: get_pattern_matching_candidates(doc, patterns) without return types