code: def get_topn_preds_and_probs(
      preds: np.ndarray,
      topn: int,
      classes: np.ndarray,
  ) -> List[List[Tuple[str, float]]]:
      # TODO
      # if only need 1 (max) value, use faster numpy ops?
      # if topn == 1:
      #     idxs = np.argmax(preds, axis=1)
      #     pred_probs = np.max(preds, axis=1)
      #     pred_langs = self.classes[idxs]
      #     return list(zip(pred_langs, pred_probs))
      # otherwise, do the full array sorts to get topn max
      # else:
      idxs = np.argsort(preds, axis=1)[:, ::-1][:, :topn]
      pred_probs = np.sort(preds, axis=1)[:, ::-1][:, :topn]
      pred_langs = classes[idxs]
      return [
          list(zip(pred_langs[i], pred_probs[i]))
          for i in range(pred_probs.shape[0])
      ]
  
file_path: textacy/src/textacy/lang_id/models.py
imports: from __future__ import annotations
  from typing import Callable, List, Optional, Sequence, Tuple
  import numpy
  import thinc
  import thinc.layers
  import thinc.types
  from cytoolz import itertoolz
  from thinc.api import Model, chain, concatenate
label_desc: Use image node_id 2 for calling a global function with example usage: get_topn_preds_and_probs(preds, topn, classes) and returns: unknown