code: def _get_candidates(
      doc: Doc,
      normalize: Optional[str | Callable],
      include_pos: Optional[set[str]],
  ) -> set[tuple[str, ...]]:
      """
      Get a set of candidate terms to be scored by joining the longest
      subsequences of valid words -- non-stopword and non-punct, filtered to
      nouns, proper nouns, and adjectives if ``doc`` is POS-tagged -- then
      normalized into strings.
      """
  
      def _is_valid_tok(tok):
          return not (tok.is_stop or tok.is_punct or tok.is_space) and (
              include_pos is None or tok.pos_ in include_pos
          )
  
      candidates = ext_utils.get_longest_subsequence_candidates(
          doc, _is_valid_tok
      )
      return {
          tuple(ext_utils.terms_to_strings(candidate, normalize))  # type: ignore
          for candidate in candidates
      }
  
file_path: textacy/src/textacy/extract/keyterms/textrank.py
imports: from __future__ import annotations
  import collections
  from operator import itemgetter
  from typing import Callable, Collection, Optional
  from spacy.tokens import Doc, Token
  from ...None import representations, utils
  from ..None import utils
label_desc: Use image node_id 2 for calling a global function with example usage: _get_candidates(doc, normalize, include_pos) and returns: unknown, unknown