Class: Html2rss::Scoring::Observation
- Inherits:
-
Data
- Object
- Data
- Html2rss::Scoring::Observation
- Defined in:
- lib/html2rss/scoring/observation.rb
Overview
Typed container signals produced by ContainerAssessor for Engine rules.
Instance Attribute Summary collapse
-
#article_container ⇒ Object
readonly
Returns the value of attribute article_container.
-
#content_path ⇒ Object
readonly
Returns the value of attribute content_path.
-
#content_tokens ⇒ Object
readonly
Returns the value of attribute content_tokens.
-
#descriptive_context ⇒ Object
readonly
Returns the value of attribute descriptive_context.
-
#high_confidence_junk_path ⇒ Object
readonly
Returns the value of attribute high_confidence_junk_path.
-
#high_confidence_utility_destination ⇒ Object
readonly
Returns the value of attribute high_confidence_utility_destination.
-
#junk_tokens ⇒ Object
readonly
Returns the value of attribute junk_tokens.
-
#path_length ⇒ Object
readonly
Returns the value of attribute path_length.
-
#publish_marker ⇒ Object
readonly
Returns the value of attribute publish_marker.
-
#recommended_title ⇒ Object
readonly
Returns the value of attribute recommended_title.
-
#selected_anchor_present ⇒ Object
readonly
Returns the value of attribute selected_anchor_present.
-
#shallow ⇒ Object
readonly
Returns the value of attribute shallow.
-
#strong_post_suffix ⇒ Object
readonly
Returns the value of attribute strong_post_suffix.
-
#title_word_count ⇒ Object
readonly
Returns the value of attribute title_word_count.
-
#utility_path ⇒ Object
readonly
Returns the value of attribute utility_path.
-
#utility_prefix_title ⇒ Object
readonly
Returns the value of attribute utility_prefix_title.
Instance Method Summary collapse
-
#hard_junk?(mode: :strict) ⇒ Boolean
True when the observation should be dropped before ranking.
-
#weak_signals? ⇒ Boolean
True when fewer than two positive content signals are present.
Instance Attribute Details
#article_container ⇒ Object (readonly)
Returns the value of attribute article_container
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def article_container @article_container end |
#content_path ⇒ Object (readonly)
Returns the value of attribute content_path
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def content_path @content_path end |
#content_tokens ⇒ Object (readonly)
Returns the value of attribute content_tokens
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def content_tokens @content_tokens end |
#descriptive_context ⇒ Object (readonly)
Returns the value of attribute descriptive_context
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def descriptive_context @descriptive_context end |
#high_confidence_junk_path ⇒ Object (readonly)
Returns the value of attribute high_confidence_junk_path
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def high_confidence_junk_path @high_confidence_junk_path end |
#high_confidence_utility_destination ⇒ Object (readonly)
Returns the value of attribute high_confidence_utility_destination
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def high_confidence_utility_destination @high_confidence_utility_destination end |
#junk_tokens ⇒ Object (readonly)
Returns the value of attribute junk_tokens
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def junk_tokens @junk_tokens end |
#path_length ⇒ Object (readonly)
Returns the value of attribute path_length
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def path_length @path_length end |
#publish_marker ⇒ Object (readonly)
Returns the value of attribute publish_marker
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def publish_marker @publish_marker end |
#recommended_title ⇒ Object (readonly)
Returns the value of attribute recommended_title
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def recommended_title @recommended_title end |
#selected_anchor_present ⇒ Object (readonly)
Returns the value of attribute selected_anchor_present
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def selected_anchor_present @selected_anchor_present end |
#shallow ⇒ Object (readonly)
Returns the value of attribute shallow
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def shallow @shallow end |
#strong_post_suffix ⇒ Object (readonly)
Returns the value of attribute strong_post_suffix
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def strong_post_suffix @strong_post_suffix end |
#title_word_count ⇒ Object (readonly)
Returns the value of attribute title_word_count
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def title_word_count @title_word_count end |
#utility_path ⇒ Object (readonly)
Returns the value of attribute utility_path
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def utility_path @utility_path end |
#utility_prefix_title ⇒ Object (readonly)
Returns the value of attribute utility_prefix_title
7 8 9 |
# File 'lib/html2rss/scoring/observation.rb', line 7 def utility_prefix_title @utility_prefix_title end |
Instance Method Details
#hard_junk?(mode: :strict) ⇒ Boolean
Returns true when the observation should be dropped before ranking.
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/html2rss/scoring/observation.rb', line 34 def hard_junk?(mode: :strict) case mode when :strict high_confidence_junk_path || chrome_title_junk? when :lenient (high_confidence_junk_path && weak_signals?) || chrome_title_junk? else raise ArgumentError, "unknown hard_junk mode: #{mode.inspect}" end end |
#weak_signals? ⇒ Boolean
Returns true when fewer than two positive content signals are present.
27 28 29 |
# File 'lib/html2rss/scoring/observation.rb', line 27 def weak_signals? [article_container, publish_marker, descriptive_context, content_path].count(&:itself) < 2 end |