class_docstr: Implements the *TextRank* algorithm defined by
  [[mihalcea04textrank]](https://derwen.ai/docs/ptr/biblio/#mihalcea04textrank),
  deployed as a `spaCy` pipeline component.
  
  This class does not get called directly; instantiate its factory
  instead.
      
class_docstr_tok: ["Implements","the","*","TextRank","*","algorithm","defined","by","[","[","mihalcea04textrank","]","]","(","https",":","\/\/derwen.ai\/docs\/ptr\/biblio\/","#","mihalcea04textrank",")",",","deployed","as","a","`","spaCy","`","pipeline","component",".","This","class","does","not","get","called","directly",";","instantiate","its","factory","instead","."]
docstr: For each sentence in the document, calculate its distance from a *unit
  vector* of top-ranked phrases.
  
      limit_phrases:
  maximum number of top-ranked phrases to use in the *unit vector*
  
      returns:
  a list of sentence distance measures
          
code: def calc_sent_dist(
      self,
      limit_phrases: int,
  ) -> typing.List[Sentence]:
      """
      For each sentence in the document, calculate its distance from a *unit
      vector* of top-ranked phrases.
  
          limit_phrases:
      maximum number of top-ranked phrases to use in the *unit vector*
  
          returns:
      a list of sentence distance measures
      """
      unit_vector = self.get_unit_vector(limit_phrases)
  
      sent_dist: typing.List[Sentence] = [
          Sentence(
              start=s.start,
              end=s.end,
              sent_id=sent_id,
              phrases=set(),
              distance=0.0,
          )
          for sent_id, s in enumerate(self.doc.sents)
      ]
  
      # identify the top-ranked phrases in each sentence
      for elem in unit_vector:
          for chunk in elem.phrase.chunks:
              for sent in sent_dist:
                  if (
                      chunk.start >= sent.start
                      and chunk.end <= sent.end
                  ):
                      sent.phrases.add(elem.phrase_id)
                      break
  
      # calculate a euclidean distance for each sentence; in other
      # words, test for inclusion of each phrase in the unit vector
      for sent in sent_dist:
          sum_sq = 0.0
  
          for elem in unit_vector:
              if elem.phrase_id not in sent.phrases:
                  sum_sq += elem.coord**2.0
  
          sent.distance = math.sqrt(sum_sq)
  
      return sent_dist
  
imports: from collections import Counter, defaultdict, OrderedDict
  from dataclasses import dataclass
  import json
  import math
  import pathlib
  import time
  import typing
  from icecream import ic
  from spacy.tokens import Doc, Span, Token
  import graphviz
  import networkx
  from .util import groupby_apply, default_scrubber
label_desc: Use image node_id 14 for calling the BaseTextRank obj's underlying member method code with example usage: obj.calc_sent_dist(limit_phrases) and returns: sent_dist