class_docstr: LexRank: Graph-based Centrality as Salience in Text Summarization
  Source: http://tangra.si.umich.edu/~radev/lexrank/lexrank.pdf
class_docstr_tok: ["LexRank",":","Graph-based","Centrality","as","Salience","in","Text","Summarization","Source",":","http",":","\/\/tangra.si.umich.edu\/~radev\/lexrank\/lexrank.pdf"]
docstr: Creates matrix of shape |sentences|×|sentences|.
docstr_tok: ["Creates","matrix","of","shape","|sentences|\u00d7|sentences|","."]
code: def _create_matrix(
      self, sentences, threshold, tf_metrics, idf_metrics
  ):
      """
      Creates matrix of shape |sentences|×|sentences|.
      """
      # create matrix |sentences|×|sentences| filled with zeroes
      sentences_count = len(sentences)
      matrix = numpy.zeros((sentences_count, sentences_count))
      degrees = numpy.zeros((sentences_count,))
  
      for row, (sentence1, tf1) in enumerate(
          zip(sentences, tf_metrics)
      ):
          for col, (sentence2, tf2) in enumerate(
              zip(sentences, tf_metrics)
          ):
              matrix[row, col] = self.cosine_similarity(
                  sentence1, sentence2, tf1, tf2, idf_metrics
              )
  
              if matrix[row, col] > threshold:
                  matrix[row, col] = 1.0
                  degrees[row] += 1
              else:
                  matrix[row, col] = 0
  
      for row in range(sentences_count):
          for col in range(sentences_count):
              if degrees[row] == 0:
                  degrees[row] = 1
  
              matrix[row][col] = matrix[row][col] / degrees[row]
  
      return matrix
  
file_path: sumy/sumy/summarizers/lex_rank.py
imports: from __future__ import absolute_import
  from __future__ import division, print_function, unicode_literals
  import math
  from collections import Counter
  from ._summarizer import AbstractSummarizer
label_desc: Use image node_id 9 for calling the LexRankSummarizer obj's underlying member method code with example usage: obj._create_matrix(sentences, threshold, tf_metrics, idf_metrics) and returns: matrix