code: def apply_idf_weighting(
      doc_term_matrix: sp.csr_matrix,
      *,
      type_: Literal["standard", "smooth", "bm25"] = "smooth",
  ) -> sp.csr_matrix:
      """
      Apply inverse document frequency (idf) weighting to a term-frequency (tf)
      weighted document-term matrix, using one of several IDF formulations.
  
      Args:
          doc_term_matrix: M x N sparse matrix, where M is the # of docs and
              N is the # of unique terms.
          type_: Type of IDF formulation to use.
  
      Returns:
          Sparse matrix of shape M x N,
          where value (i, j) is the tfidf weight of term j in doc i.
  
      See Also:
          :func:`get_inverse_doc_freqs()`
      """
      idfs = get_inverse_doc_freqs(doc_term_matrix, type_=type_)
      return doc_term_matrix.dot(sp.diags(idfs, 0))
  
file_path: textacy/src/textacy/representations/matrix_utils.py
imports: from __future__ import annotations
  from typing import Literal, Optional
  import numpy
  import scipy.sparse
  from ..None import errors
label_desc: Use image node_id 6 for calling a global function with example usage: apply_idf_weighting(doc_term_matrix) and returns: doc_term_matrix