Class: Html2rss::AutoSource::Discovery::SemanticAnchorCandidates::AnchorFacts

Inherits:
Data
  • Object
show all
Defined in:
lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb

Overview

Anchor candidate plus scoring signals used by semantic anchor ranking.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#anchorObject (readonly)

Returns the value of attribute anchor

Returns:

  • (Object)

    the current value of anchor



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def anchor
  @anchor
end

#content_like_destinationObject (readonly)

Returns the value of attribute content_like_destination

Returns:

  • (Object)

    the current value of content_like_destination



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def content_like_destination
  @content_like_destination
end

#destinationObject (readonly)

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def destination
  @destination
end

#heading_anchorObject (readonly)

Returns the value of attribute heading_anchor

Returns:

  • (Object)

    the current value of heading_anchor



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def heading_anchor
  @heading_anchor
end

#heading_text_matchObject (readonly)

Returns the value of attribute heading_text_match

Returns:

  • (Object)

    the current value of heading_text_match



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def heading_text_match
  @heading_text_match
end

#meaningful_textObject (readonly)

Returns the value of attribute meaningful_text

Returns:

  • (Object)

    the current value of meaningful_text



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def meaningful_text
  @meaningful_text
end

#scoreObject (readonly)

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def score
  @score
end

#segmentsObject (readonly)

Returns the value of attribute segments

Returns:

  • (Object)

    the current value of segments



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def segments
  @segments
end

#textObject (readonly)

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def text
  @text
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



10
11
12
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 10

def url
  @url
end

Class Method Details

.from_candidate(candidate) ⇒ AnchorFacts

Returns serializable facts used for ranking and dedupe.

Parameters:

  • candidate (Candidate)

    eligible semantic anchor candidate

Returns:

  • (AnchorFacts)

    serializable facts used for ranking and dedupe



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/html2rss/auto_source/discovery/semantic_anchor_candidates.rb', line 24

def self.from_candidate(candidate)
  signals = candidate.anchor_signals

  new(
    **candidate.anchor_identity_attributes,
    meaningful_text: signals.meaningful_text,
    content_like_destination: signals.content_like_destination,
    heading_anchor: signals.heading_anchor,
    heading_text_match: signals.heading_text_match,
    score: signals.score
  )
end