code: def _get_ngram_length_pmi_thresholds(
      self, pmi_df: pd.DataFrame
  ) -> pd.DataFrame:
      return (
          pmi_df[
              lambda df: (df.Len > 1)
              & (df.Count >= self.minimum_term_count)
          ]
          .groupby("Len")
          .apply(
              lambda gdf: pd.Series({"NPMI": 0})
              if len(gdf) <= self.number_terms_per_length
              else gdf.sort_values(by="NPMI", ascending=False).iloc[
                  self.number_terms_per_length
              ][["NPMI"]]
          )
          .rename(columns={"NPMI": "NPMIThreshold"})
      )
  
file_path: scattertext/scattertext/termcompaction/npmi_compactor.py
imports: import numpy
  import pandas
  from tqdm.auto import tqdm
  from scattertext.termranking.TermRanker import TermRanker
  from scattertext.termranking.AbsoluteFrequencyRanker import AbsoluteFrequencyRanker
label_desc: Use image node_id 5 for calling the NPMICompactor obj's underlying member method code with example usage: obj._get_ngram_length_pmi_thresholds(pmi_df) and returns: pmi_df