class_docstr: Objects of this abstract class realize the transformation between word-document co-occurrence
  matrix (int) into a BM25 matrix (positive floats). Concrete subclasses of this abstract class
  implement different BM25 scoring functions.
class_docstr_tok: ["Objects","of","this","abstract","class","realize","the","transformation","between","word-document","co-occurrence","matrix","(","int",")","into","a","BM25","matrix","(","positive","floats",")",".","Concrete","subclasses","of","this","abstract","class","implement","different","BM25","scoring","functions","."]
code: def __getitem__(self, bow):
      is_corpus, bow = utils.is_corpus(bow)
      if is_corpus:
          return self._apply(bow)
  
      num_tokens = sum(freq for term_id, freq in bow)
  
      term_ids, term_frequencies, idfs = [], [], []
      for term_id, term_frequency in bow:
          term_ids.append(term_id)
          term_frequencies.append(term_frequency)
          idfs.append(self.idfs.get(term_id) or 0.0)
      term_frequencies, idfs = np.array(term_frequencies), np.array(
          idfs
      )
  
      term_weights = self.get_term_weights(
          num_tokens, term_frequencies, idfs
      )
  
      vector = [
          (term_id, float(weight))
          for term_id, weight in zip(term_ids, term_weights)
      ]
      return vector
  
imports: from abc import ABCMeta, abstractmethod
  from collections import defaultdict
  import logging
  import math
  from gensim import interfaces, utils
  import numpy
label_desc: Use image node_id 4 for calling the BM25ABC obj's underlying member method code with example usage: obj.__getitem__(bow) and returns: vector, self