MCPcopy Create free account
hub / github.com/DavidBelicza/TextRank / WeightingHits

Method WeightingHits

rank/algorithm.go:81–99  ·  view source on GitHub ↗

WeightingHits method ranks the words by their occurrence.

(
	wordID int,
	rank *Rank,
)

Source from the content-addressed store, hash-verified

79
80// WeightingHits method ranks the words by their occurrence.
81func (a *AlgorithmChain) WeightingHits(
82 wordID int,
83 rank *Rank,
84) float32 {
85 word := rank.Words[wordID]
86 qty := 0
87
88 for leftWordID, leftWordQty := range word.ConnectionLeft {
89 qty += rank.Words[leftWordID].Qty * leftWordQty
90 }
91
92 for rightWordID, rightWordQty := range word.ConnectionRight {
93 qty += rank.Words[rightWordID].Qty * rightWordQty
94 }
95
96 weight := float32(word.Qty) + (float32(qty))
97
98 return float32(weight)
99}

Callers 1

TestWeightingHitsFunction · 0.95

Calls

no outgoing calls

Tested by 1

TestWeightingHitsFunction · 0.76