module NewsScraper

Constants

VERSION

Attributes

configuration[W]

Public Instance Methods

configuration() click to toggle source

:nocov:

# File lib/news_scraper.rb, line 47
def configuration
  @configuration ||= Configuration.new
end
configure() { |configuration| ... } click to toggle source
# File lib/news_scraper.rb, line 55
def configure
  yield(configuration)
end
reset_configuration() click to toggle source
# File lib/news_scraper.rb, line 51
def reset_configuration
  @configuration = Configuration.new
end
train(query:) click to toggle source

NewsScraper::train is an interactive command-line prompt that:

  1. Collates all articles for the given :query

  2. Grep for :data_types using :presets in the config set in the configuration

  3. Displays the results of each :preset grep for a given :data_type

  4. Prompts to select one of the :presets or define a pattern for that domain's :data_type

N.B: User may ignore all presets and manually configure it in the YAML file

  1. Saves the selected :preset to config/article_scrape_patterns.yml

Params

  • query: a keyword arugment specifying the query to train on

:nocov:

# File lib/news_scraper.rb, line 42
def train(query:)
  Trainer.train(query: query)
end