Module: Html2rss::Scoring::FeatureId

Defined in:
lib/html2rss/scoring.rb

Overview

Closed set of feature identifiers used by the scoring registry.

Constant Summary collapse

IDS =

Closed set of allowed feature identifier symbols.

%i[
  title_word_count_ge3 title_word_count_ge7 path_length_gt6 content_path
  publish_marker descriptive_context article_container content_tokens
  non_content_utility_path utility_prefix_title_short shallow weak_container
  recommended_title_non_content high_confidence_junk_path junk_tokens
  heading_anchor heading_text_match meaningful_text content_like_destination
  cluster_size cluster_avg_words cluster_heading cluster_time cluster_date
].to_set.freeze

Class Method Summary collapse

Class Method Details

.assert!(id) ⇒ Symbol

Parameters:

  • id (Symbol)

Returns:

  • (Symbol)

Raises:

  • (ArgumentError)

    when id is not in the closed set



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

def assert!(id)
  raise ArgumentError, "unknown FeatureId: #{id.inspect}" unless IDS.include?(id)

  id
end