(doc_or_tokens: types.DocOrTokens)
return tuple(len(word) for word in words)
Compute the number of characters for each word 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.

    Note:
        This function is cached, since other functions rely upon its outputs
        to compute theirs. As such, ``doc_or_tokens`` must be hashable -- for example,
        it may be a ``Doc`` or ``Tuple[Token, ...]`` , but not a ``List[Token]`` .
Compute the number of characters for each word in a document.
Compute the number of characters for each word in a document .
def n_chars_per_word(doc_or_tokens: types.DocOrTokens) -> Tuple[int, ...]:
    """
    Compute the number of characters for each word 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.

    Note:
        This function is cached, since other functions rely upon its outputs
        to compute theirs. As such, ``doc_or_tokens`` must be hashable -- for example,
        it may be a ``Doc`` or ``Tuple[Token, ...]`` , but not a ``List[Token]`` .
    """
    words = utils.get_words(doc_or_tokens)
    return tuple(len(word) for word in words)
def n_chars_per_word ( doc_or_tokens : types . DocOrTokens ) -> Tuple [ int , ... ] : words = utils . get_words ( doc_or_tokens ) return tuple ( len ( word ) for word in words )