WeightingHits method ranks the words by their occurrence.
( wordID int, rank *Rank, )
| 79 | |
| 80 | // WeightingHits method ranks the words by their occurrence. |
| 81 | func (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 | } |
no outgoing calls