code: def entities(
      doclike: types.DocLike,
      *,
      include_types: Optional[str | Collection[str]] = None,
      exclude_types: Optional[str | Collection[str]] = None,
      drop_determiners: bool = True,
      min_freq: int = 1,
  ) -> Iterable[Span]:
      """
      Extract an ordered sequence of named entities (PERSON, ORG, LOC, etc.) from
      a ``Doc``, optionally filtering by entity types and frequencies.
  
      Args:
          doclike
          include_types: Remove entities whose type IS NOT
              in this param; if "NUMERIC", all numeric entity types ("DATE",
              "MONEY", "ORDINAL", etc.) are included
          exclude_types: Remove entities whose type IS
              in this param; if "NUMERIC", all numeric entity types ("DATE",
              "MONEY", "ORDINAL", etc.) are excluded
          drop_determiners: Remove leading determiners (e.g. "the")
              from entities (e.g. "the United States" => "United States").
  
              .. note:: Entities from which a leading determiner has been removed
                 are, effectively, *new* entities, and not saved to the ``Doc``
                 from which they came. This is irritating but unavoidable, since
                 this function is not meant to have side-effects on document state.
                 If you're only using the text of the returned spans, this is no
                 big deal, but watch out if you're counting on determiner-less
                 entities associated with the doc downstream.
  
          min_freq: Remove entities that occur in ``doclike`` fewer
              than ``min_freq`` times
  
      Yields:
          Next entity from ``doclike`` passing all specified filters in order of appearance
          in the document
  
      Raises:
          TypeError: if ``include_types`` or ``exclude_types`` is not a str, a set of
              str, or a falsy value
      """
      ents = doclike.ents
      # HACK: spacy's models have been erroneously tagging whitespace as entities
      # https://github.com/explosion/spaCy/commit/1e6725e9b734862e61081a916baf440697b9971e
      ents = (ent for ent in ents if not ent.text.isspace())
      include_types = _parse_ent_types(include_types, "include")
      exclude_types = _parse_ent_types(exclude_types, "exclude")
      if include_types:
          if isinstance(include_types, str):
              ents = (
                  ent for ent in ents if ent.label_ == include_types
              )
          elif isinstance(include_types, (set, frozenset, list, tuple)):
              ents = (
                  ent for ent in ents if ent.label_ in include_types
              )
      if exclude_types:
          if isinstance(exclude_types, str):
              ents = (
                  ent for ent in ents if ent.label_ != exclude_types
              )
          elif isinstance(exclude_types, (set, frozenset, list, tuple)):
              ents = (
                  ent for ent in ents if ent.label_ not in exclude_types
              )
      if drop_determiners is True:
          ents = (
              ent
              if ent[0].pos != DET
              else Span(
                  ent.doc,
                  ent.start + 1,
                  ent.end,
                  label=ent.label,
                  vector=ent.vector,
              )
              for ent in ents
          )
      if min_freq > 1:
          ents = list(ents)  # type: ignore
          freqs = itertoolz.frequencies(
              ent.text.lower() for ent in ents
          )
          ents = (
              ent for ent in ents if freqs[ent.text.lower()] >= min_freq
          )
  
      for ent in ents:
          yield ent
  
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 3 for calling a global function with example usage: entities(doclike) without return types