code: def get_doc_freqs(doc_term_matrix: sp.csr_matrix) -> np.ndarray:
      """
      Compute document frequencies for all terms in a document-term matrix.
  
      Args:
          doc_term_matrix: M x N sparse matrix, where M is the # of docs and
              N is the # of unique terms.
  
              .. note:: Weighting on the terms doesn't matter! Could be binary or
                 tf or tfidf, a term's doc freq will be the same.
  
      Returns:
          Array of document frequencies, with length equal to the # of unique terms
          (i.e. # of columns) in ``doc_term_matrix``.
  
      Raises:
          ValueError: if ``doc_term_matrix`` doesn't have any non-zero entries.
      """
      if doc_term_matrix.nnz == 0:
          raise ValueError(
              "`doc_term_matrix` must have at least 1 non-zero entry"
          )
      _, n_terms = doc_term_matrix.shape
      return np.bincount(doc_term_matrix.indices, minlength=n_terms)
  
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 2 for calling a global function with example usage: get_doc_freqs(doc_term_matrix) and returns: np