code: def build_doc_term_matrix(
      tokenized_docs: Iterable[Iterable[str]],
      *,
      tf_type: Literal["linear", "sqrt", "log", "binary"] = "linear",
      idf_type: Optional[Literal["standard", "smooth", "bm25"]] = None,
      dl_type: Optional[Literal["linear", "sqrt", "log"]] = None,
      **kwargs,
  ) -> tuple[sp.csr_matrix, dict[str, int]]:
      """
      Transform one or more tokenized documents into a document-term matrix
      of shape (# docs, # unique terms), with flexible weighting/normalization of values.
  
      Args:
          tokenized_docs: A sequence of tokenized documents, where each is a sequence
              of term strings. For example::
  
                  >>> ([tok.lemma_ for tok in spacy_doc]
                  ...  for spacy_doc in spacy_docs)
                  >>> ((ne.text for ne in extract.entities(doc))
                  ...  for doc in corpus)
  
          tf_type: Type of term frequency (tf) to use for weights' local component:
  
              - "linear": tf (tfs are already linear, so left as-is)
              - "sqrt": tf => sqrt(tf)
              - "log": tf => log(tf) + 1
              - "binary": tf => 1
  
          idf_type: Type of inverse document frequency (idf) to use for weights'
              global component:
  
              - "standard": idf = log(n_docs / df) + 1.0
              - "smooth": idf = log(n_docs + 1 / df + 1) + 1.0, i.e. 1 is added
                to all document frequencies, as if a single document containing
                every unique term was added to the corpus.
              - "bm25": idf = log((n_docs - df + 0.5) / (df + 0.5)), which is
                a form commonly used in information retrieval that allows for
                very common terms to receive negative weights.
              - None: no global weighting is applied to local term weights.
  
          dl_type: Type of document-length scaling to use for weights'
              normalization component:
  
              - "linear": dl (dls are already linear, so left as-is)
              - "sqrt": dl => sqrt(dl)
              - "log": dl => log(dl)
              - None: no normalization is applied to local (+global?) weights
  
          **kwargs: Passed directly into vectorizer class
  
      Returns:
          Document-term matrix as a sparse row matrix, and
          the corresponding mapping of term strings to integer ids (column indexes).
  
      Note:
          If you need to transform other sequences of tokenized documents in the same way,
          or if you need more access to the underlying vectorization process,
          consider using :class:`textacy.representations.vectorizers.Vectorizer` directly.
  
      See Also:
          - :class:`textacy.representations.vectorizers.Vectorizer`
          - :class:`scipy.sparse.csr_matrix`
  
      Reference:
          https://en.wikipedia.org/wiki/Document-term_matrix
      """
      vectorizer = vectorizers.Vectorizer(
          tf_type=tf_type, idf_type=idf_type, dl_type=dl_type, **kwargs
      )
      doc_term_matrix = vectorizer.fit_transform(tokenized_docs)
      return (doc_term_matrix, vectorizer.vocabulary_terms)
  
imports: from typing import Iterable, Literal, Optional
  import scipy.sparse
  from .None import vectorizers
label_desc: Use image node_id 1 for calling a global function with example usage: build_doc_term_matrix(tokenized_docs) and returns: doc_term_matrix,  vectorizer