code: 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_: set[str] = {
              pos.upper() for pos in utils.to_set(include_pos)
          }
          words_ = (w for w in words_ if w.pos_ in include_pos_)
      if exclude_pos:
          exclude_pos_: set[str] = {
              pos.upper() for pos in utils.to_set(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
  
file_path: textacy/src/textacy/extract/basics.py
imports: from __future__ import annotations
  from functools import partial
  from typing import Collection, Iterable, Optional, Union
  from cytoolz import itertoolz
  from spacy.parts_of_speech import DET
  from spacy.tokens import Span, Token
  from ..None import constants, errors, types, utils
label_desc: Use image node_id 1 for calling a global function with example usage: words(doclike) without return types