Skip to main content

rank-sentences-keyphrases

ai-research-agent / topics/rank-sentences-keyphrases

Functions

rankSentencesCentralToKeyphrase()

function rankSentencesCentralToKeyphrase(sentencesWithKeyphrases, options): Object[]

Rank sentences based on their centrality to key phrases. This function implements the TextRank algorithm to weight each sentence based on the number of key phrases it shares with other sentences. It creates a weighted graph where edges connect sentences to matching keyphrases, then performs random walks to distribute probabilities.


  1. Hongyang Zhao and Qiang Xie 2021 J. Phys.: Conf. Ser. 2078 012021 "An Improved TextRank Multi-feature Fusion Algorithm For Keyword Extraction of Educational Resources" https://iopscience.iop.org/article/10.1088/1742-6596/2078/1/012021/pdf

  1. Pan, S. et al (2019). "An improved TextRank keywords extraction algorithm" https://dl.acm.org/doi/10.1145/3321408.3326659 https://doi.org/10.1145/3321408.3326659

Parameters

ParameterTypeDescription

sentencesWithKeyphrases

Object[]

Array of objects, each containing (text, keyphrases)

options

{}

Returns

Object[]

Updated array with added weights: text, keyphrases, weight