(
    doc_or_tokens: types.DocOrTokens,
    *,
    lang: Optional[str] = None,
    min_n_syllables: int = 3,
)
return itertoolz.count(ns for ns in nspw if ns >= min_n_syllables)
Compute the number of polysyllobic 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.
        lang: Standard 2-letter language code used to load hyphenator.
            If not specified and ``doc_or_tokens`` is a spaCy ``Doc`` ,
            the value will be gotten from ``Doc.lang_`` .
        min_n_syllables: Minimum number of syllables required for a word to be
            considered "polysyllobic".

    See Also:
        :func:`n_syllables_per_word()`
Compute the number of polysyllobic words in a document.
Compute the number of polysyllobic words in a document .
def n_polysyllable_words(
    doc_or_tokens: types.DocOrTokens,
    *,
    lang: Optional[str] = None,
    min_n_syllables: int = 3,
) -> int:
    """
    Compute the number of polysyllobic 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.
        lang: Standard 2-letter language code used to load hyphenator.
            If not specified and ``doc_or_tokens`` is a spaCy ``Doc`` ,
            the value will be gotten from ``Doc.lang_`` .
        min_n_syllables: Minimum number of syllables required for a word to be
            considered "polysyllobic".

    See Also:
        :func:`n_syllables_per_word()`
    """
    # docs are hashable, so we can leverage the lru cache as-is
    if isinstance(doc_or_tokens, Doc):
        nspw = n_syllables_per_word(doc_or_tokens, lang=lang)
    # 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)
        nspw = n_syllables_per_word(tuple(words), lang=lang)
    return itertoolz.count(ns for ns in nspw if ns >= min_n_syllables)
def n_polysyllable_words ( doc_or_tokens : types . DocOrTokens , * , lang : Optional [ str ] = None , min_n_syllables : int = 3 , ) -> int : # docs are hashable, so we can leverage the lru cache as-is if isinstance ( doc_or_tokens , Doc ) : nspw = n_syllables_per_word ( doc_or_tokens , lang = lang ) # 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 ) nspw = n_syllables_per_word ( tuple ( words ) , lang = lang ) return itertoolz . count ( ns for ns in nspw if ns >= min_n_syllables )