Module: Html2rss::Scoring::AnchorScore

Defined in:
lib/html2rss/scoring/anchor_score.rb

Overview

Primary-link ranking weights (sole home; FeatureId-aligned).

Constant Summary collapse

WEIGHTS =

Signal → integer weight map for primary-link ranking.

{
  heading_anchor: 100,
  heading_text_match: 20,
  meaningful_text: 10,
  content_like_destination: 10
}.freeze

Class Method Summary collapse

Class Method Details

.score(heading_anchor:, heading_text_match:, meaningful_text:, content_like_destination:) ⇒ Integer

Parameters:

  • heading_anchor (Boolean)
  • heading_text_match (Boolean)
  • meaningful_text (Boolean)
  • content_like_destination (Boolean)

Returns:

  • (Integer)


24
25
26
27
28
29
30
31
# File 'lib/html2rss/scoring/anchor_score.rb', line 24

def score(heading_anchor:, heading_text_match:, meaningful_text:, content_like_destination:)
  total = 0
  total += WEIGHTS[:heading_anchor] if heading_anchor
  total += WEIGHTS[:heading_text_match] if heading_text_match
  total += WEIGHTS[:meaningful_text] if meaningful_text
  total += WEIGHTS[:content_like_destination] if content_like_destination
  total
end