class_docstr: Method that greedily adds sentences to a summary so long as it decreases the
  KL Divergence.
  Source: http://www.aclweb.org/anthology/N09-1041
class_docstr_tok: ["Method","that","greedily","adds","sentences","to","a","summary","so","long","as","it","decreases","the","KL","Divergence",".","Source",":","http",":","\/\/www.aclweb.org\/anthology\/N09-1041"]
code: def _compute_ratings(self, sentences):
      word_freq = self.compute_tf(sentences)
      ratings = {}
      summary = []
  
      # make it a list so that it can be modified
      sentences_list = list(sentences)
  
      # get all content words once for efficiency
      sentences_as_words = [
          self._get_content_words_in_sentence(s) for s in sentences
      ]
  
      # Removes one sentence per iteration by adding to summary
      while len(sentences_list) > 0:
          # will store all the kls values for this pass
          kls = []
  
          # converts summary to word list
          summary_as_word_list = self._get_all_words_in_doc(summary)
  
          for s in sentences_as_words:
              # calculates the joint frequency through combining the word lists
              joint_freq = self._joint_freq(s, summary_as_word_list)
  
              # adds the calculated kl divergence to the list in index = sentence used
              kls.append(self._kl_divergence(joint_freq, word_freq))
  
          # to consider and then add it into the summary
          index_to_remove = self._find_index_of_best_sentence(kls)
          best_sentence = sentences_list.pop(index_to_remove)
          del sentences_as_words[index_to_remove]
          summary.append(best_sentence)
  
          # value is the iteration in which it was removed multiplied by -1 so that
          # the first sentences removed (the most important) have highest values
          ratings[best_sentence] = -1 * len(ratings)
  
      return ratings
  
file_path: sumy/sumy/summarizers/kl.py
imports: from __future__ import absolute_import
  from __future__ import division, print_function, unicode_literals
  import math
  from ._summarizer import AbstractSummarizer
label_desc: Use image node_id 12 for calling the KLSummarizer obj's underlying member method code with example usage: obj._compute_ratings(sentences) and returns: ratings