(
    doc: Doc,
    normalize: Optional[str | Callable[[Span], str]],
    ngrams: Tuple[int, ...],
    include_pos: Set[str],
)
return candidates, cand_counts
Get n-gram candidate keyterms from ``doc``, with key information for each:
    its normalized text string, position within the doc, number of constituent words,
    and frequency of occurrence.
Get n-gram candidate keyterms from ``doc``, with key information for each:
    its normalized text string, position within the doc, number of constituent words,
    and frequency of occurrence.
Get n - gram candidate keyterms from doc with key information for each : its normalized text string position within the doc number of constituent words and frequency of occurrence .
def _get_candidates(
    doc: Doc,
    normalize: Optional[str | Callable[[Span], str]],
    ngrams: Tuple[int, ...],
    include_pos: Set[str],
) -> Tuple[List[Candidate], Counter[str]]:
    """
    Get n-gram candidate keyterms from ``doc``, with key information for each:
    its normalized text string, position within the doc, number of constituent words,
    and frequency of occurrence.
    """
    min_term_freq = min(max(len(doc) // 1000, 1), 4)
    cand_tuples = list(
        ext_utils.get_ngram_candidates(doc, ngrams, include_pos=include_pos)
    )
    cand_texts = [
        " ".join(ext_utils.terms_to_strings(ctup, normalize or "orth"))
        for ctup in cand_tuples
    ]
    cand_counts = collections.Counter(cand_texts)
    candidates = [
        Candidate(text=ctext, idx=ctup[0].i, length=len(ctup), count=cand_counts[ctext])
        for ctup, ctext in zip(cand_tuples, cand_texts)
    ]
    if min_term_freq > 1:
        candidates = [
            candidate for candidate in candidates if candidate.count >= min_term_freq
        ]
    return candidates, cand_counts
def _get_candidates ( doc : Doc , normalize : Optional [ str | Callable [ [ Span ] , str ] ] , ngrams : Tuple [ int , ... ] , include_pos : Set [ str ] , ) -> Tuple [ List [ Candidate ] , Counter [ str ] ] : min_term_freq = min ( max ( len ( doc ) // 1000 , 1 ) , 4 ) cand_tuples = list ( ext_utils . get_ngram_candidates ( doc , ngrams , include_pos = include_pos ) ) cand_texts = [ " " . join ( ext_utils . terms_to_strings ( ctup , normalize or "orth" ) ) for ctup in cand_tuples ] cand_counts = collections . Counter ( cand_texts ) candidates = [ Candidate ( text = ctext , idx = ctup [ 0 ] . i , length = len ( ctup ) , count = cand_counts [ ctext ] ) for ctup , ctext in zip ( cand_tuples , cand_texts ) ] if min_term_freq > 1 : candidates = [ candidate for candidate in candidates if candidate . count >= min_term_freq ] return candidates , cand_counts