(doc_or_tokens: types.DocOrTokens, *, min_n_chars: int = 7)
return itertoolz.count(nc for nc in ncpw if nc >= min_n_chars)
Compute the number of long 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.
        min_n_chars: Minimum number of characters required for a word to be
            considered "long".
Compute the number of long words in a document.
Compute the number of long words in a document .
def n_long_words(doc_or_tokens: types.DocOrTokens, *, min_n_chars: int = 7) -> int:
    """
    Compute the number of long 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.
        min_n_chars: Minimum number of characters required for a word to be
            considered "long".
    """
    # docs are hashable, so we can leverage the lru cache as-is
    if isinstance(doc_or_tokens, Doc):
        ncpw = n_chars_per_word(doc_or_tokens)
    # 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)
        ncpw = n_chars_per_word(tuple(words))
    return itertoolz.count(nc for nc in ncpw if nc >= min_n_chars)
def n_long_words ( doc_or_tokens : types . DocOrTokens , * , min_n_chars : int = 7 ) -> int : # docs are hashable, so we can leverage the lru cache as-is if isinstance ( doc_or_tokens , Doc ) : ncpw = n_chars_per_word ( doc_or_tokens ) # 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 ) ncpw = n_chars_per_word ( tuple ( words ) ) return itertoolz . count ( nc for nc in ncpw if nc >= min_n_chars )