Class: Html2rss::HtmlExtractor::SemanticAnchorCandidates::AnchorFacts

Inherits:
Data
  • Object
show all
Defined in:
lib/html2rss/html_extractor/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



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

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



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def content_like_destination
  @content_like_destination
end

#destinationObject (readonly)

Returns the value of attribute destination

Returns:

  • (Object)

    the current value of destination



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def destination
  @destination
end

#heading_anchorObject (readonly)

Returns the value of attribute heading_anchor

Returns:

  • (Object)

    the current value of heading_anchor



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

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



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

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



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def meaningful_text
  @meaningful_text
end

#scoreObject (readonly)

Returns the value of attribute score

Returns:

  • (Object)

    the current value of score



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def score
  @score
end

#segmentsObject (readonly)

Returns the value of attribute segments

Returns:

  • (Object)

    the current value of segments



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def segments
  @segments
end

#textObject (readonly)

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

def text
  @text
end

#urlObject (readonly)

Returns the value of attribute url

Returns:

  • (Object)

    the current value of url



9
10
11
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 9

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



23
24
25
26
27
28
29
# File 'lib/html2rss/html_extractor/semantic_anchor_candidates.rb', line 23

def self.from_candidate(candidate)
  new(
    **candidate.anchor_identity_attributes,
    **candidate.anchor_signal_attributes,
    score: Score.new(candidate).value
  )
end