class_docstr: Implements the *Biased TextRank* algorithm described by
  [[kazemi-etal-2020-biased]](https://derwen.ai/docs/ptr/biblio/#kazemi-etal-2020-biased),
  deployed as a `spaCy` pipeline component.
  
  This class does not get called directly; instantiate its factory
  instead.
      
class_docstr_tok: ["Implements","the","*","Biased","TextRank","*","algorithm","described","by","[","[","kazemi-etal-2020-biased","]","]","(","https",":","\/\/derwen.ai\/docs\/ptr\/biblio\/","#","kazemi-etal-2020-biased",")",",","deployed","as","a","`","spaCy","`","pipeline","component",".","This","class","does","not","get","called","directly",";","instantiate","its","factory","instead","."]
docstr: Get the *node weights* for initializing the use of the
  [*Personalized PageRank*](https://derwen.ai/docs/ptr/glossary/#personalized-pagerank)
  algorithm.
  
      returns:
  biased restart probabilities to use in the *PageRank* algorithm.
          
docstr_tok: ["Get","the","*","node","weights","*","for","initializing","the","use","of","the","[","*","Personalized","PageRank","*","]","(","https",":","\/\/derwen.ai\/docs\/ptr\/glossary\/","#","personalized-pagerank",")","algorithm",".","returns",":","biased","restart","probabilities","to","use","in","the","*","PageRank","*","algorithm","."]
code: def get_personalization(
      self,
  ) -> typing.Optional[typing.Dict[Lemma, float]]:
      """
      Get the *node weights* for initializing the use of the
      [*Personalized PageRank*](https://derwen.ai/docs/ptr/glossary/#personalized-pagerank)
      algorithm.
  
          returns:
      biased restart probabilities to use in the *PageRank* algorithm.
      """
      # TODO: # pylint: disable=W0511
      # => lookup bias based on (lemma, pos) instead, similar to *PositionRank*?
  
      weighted_nodes: typing.Dict[Lemma, float] = {
          Lemma(token.lemma_, token.pos_): self._get_node_bias(token)
          for token in self.doc
          if token.pos_ in self.pos_kept
      }
  
      # normalize weights
      total_weight = sum(weighted_nodes.values())
  
      if total_weight == 0.0:
          return None
  
      normalized_weighted_nodes: typing.Dict[Lemma, float] = {
          lemma: weight / total_weight
          for lemma, weight in weighted_nodes.items()
      }
  
      return normalized_weighted_nodes
  
file_path: pytextrank/pytextrank/biasedrank.py
imports: import typing
  from spacy.tokens import Doc, Token
  from .base import BaseTextRankFactory, BaseTextRank, Lemma, Phrase
label_desc: Use image node_id 2 for calling the BiasedTextRank obj's underlying member method code with example usage: obj.get_personalization() and returns: normalized_weighted_nodes, None