(
    doclike: types.DocLike,
    *,
    filter_stops: bool = True,
    filter_punct: bool = True,
    filter_nums: bool = False,
    include_pos: Optional[str | Collection[str]] = None,
    exclude_pos: Optional[str | Collection[str]] = None,
    min_freq: int = 1,
)
Extract an ordered sequence of words from a document processed by spaCy,
    optionally filtering words by part-of-speech tag and frequency.

    Args:
        doclike
        filter_stops: If True, remove stop words from word list.
        filter_punct: If True, remove punctuation from word list.
        filter_nums: If True, remove number-like words (e.g. 10, "ten")
            from word list.
        include_pos: Remove words whose part-of-speech tag IS NOT in the specified tags.
        exclude_pos: Remove words whose part-of-speech tag IS in the specified tags.
        min_freq: Remove words that occur in ``doclike`` fewer than ``min_freq`` times.

    Yields:
        Next token from ``doclike`` passing specified filters in order of appearance
        in the document.

    Raises:
        TypeError: if ``include_pos`` or ``exclude_pos`` is not a str, a set of str,
            or a falsy value

    Note:
        Filtering by part-of-speech tag uses the universal POS tag set; for details,
        check spaCy's docs: https://spacy.io/api/annotation#pos-tagging
Extract an ordered sequence of words from a document processed by spaCy,
    optionally filtering words by part-of-speech tag and frequency.
Extract an ordered sequence of words from a document processed by spaCy optionally filtering words by part - of - speech tag and frequency .
def words(
    doclike: types.DocLike,
    *,
    filter_stops: bool = True,
    filter_punct: bool = True,
    filter_nums: bool = False,
    include_pos: Optional[str | Collection[str]] = None,
    exclude_pos: Optional[str | Collection[str]] = None,
    min_freq: int = 1,
) -> Iterable[Token]:
    """
    Extract an ordered sequence of words from a document processed by spaCy,
    optionally filtering words by part-of-speech tag and frequency.

    Args:
        doclike
        filter_stops: If True, remove stop words from word list.
        filter_punct: If True, remove punctuation from word list.
        filter_nums: If True, remove number-like words (e.g. 10, "ten")
            from word list.
        include_pos: Remove words whose part-of-speech tag IS NOT in the specified tags.
        exclude_pos: Remove words whose part-of-speech tag IS in the specified tags.
        min_freq: Remove words that occur in ``doclike`` fewer than ``min_freq`` times.

    Yields:
        Next token from ``doclike`` passing specified filters in order of appearance
        in the document.

    Raises:
        TypeError: if ``include_pos`` or ``exclude_pos`` is not a str, a set of str,
            or a falsy value

    Note:
        Filtering by part-of-speech tag uses the universal POS tag set; for details,
        check spaCy's docs: https://spacy.io/api/annotation#pos-tagging
    """
    words_: Iterable[Token] = (w for w in doclike if not w.is_space)
    if filter_stops is True:
        words_ = (w for w in words_ if not w.is_stop)
    if filter_punct is True:
        words_ = (w for w in words_ if not w.is_punct)
    if filter_nums is True:
        words_ = (w for w in words_ if not w.like_num)
    if include_pos:
        include_pos = utils.to_collection(include_pos, str, set)
        include_pos = {pos.upper() for pos in include_pos}
        words_ = (w for w in words_ if w.pos_ in include_pos)
    if exclude_pos:
        exclude_pos = utils.to_collection(exclude_pos, str, set)
        exclude_pos = {pos.upper() for pos in exclude_pos}
        words_ = (w for w in words_ if w.pos_ not in exclude_pos)
    if min_freq > 1:
        words_ = list(words_)
        freqs = itertoolz.frequencies(w.lower_ for w in words_)
        words_ = (w for w in words_ if freqs[w.lower_] >= min_freq)

    for word in words_:
        yield word
def words ( doclike : types . DocLike , * , filter_stops : bool = True , filter_punct : bool = True , filter_nums : bool = False , include_pos : Optional [ str | Collection [ str ] ] = None , exclude_pos : Optional [ str | Collection [ str ] ] = None , min_freq : int = 1 , ) -> Iterable [ Token ] : words_ : Iterable [ Token ] = ( w for w in doclike if not w . is_space ) if filter_stops is True : words_ = ( w for w in words_ if not w . is_stop ) if filter_punct is True : words_ = ( w for w in words_ if not w . is_punct ) if filter_nums is True : words_ = ( w for w in words_ if not w . like_num ) if include_pos : include_pos = utils . to_collection ( include_pos , str , set ) include_pos = { pos . upper ( ) for pos in include_pos } words_ = ( w for w in words_ if w . pos_ in include_pos ) if exclude_pos : exclude_pos = utils . to_collection ( exclude_pos , str , set ) exclude_pos = { pos . upper ( ) for pos in exclude_pos } words_ = ( w for w in words_ if w . pos_ not in exclude_pos ) if min_freq > 1 : words_ = list ( words_ ) freqs = itertoolz . frequencies ( w . lower_ for w in words_ ) words_ = ( w for w in words_ if freqs [ w . lower_ ] >= min_freq ) for word in words_ : yield word