Class: NewsScraper::Transformers::Helpers::HighScoreParser

Inherits:
Object
  • Object
show all
Defined in:
lib/news_scraper/transformers/helpers/highscore_parser.rb

Class Method Summary collapse

Class Method Details

.keywords(url:, payload:) ⇒ Object

NewsScraper::Transformers::Helpers::HighScoreParser.keywords parses out keywords

Params

  • url:: keyword for the url to parse to a uri

  • payload:: keyword for the payload from a request to the url (html body)

Returns

  • keywords: Top 5 keywords from the body of text



19
20
21
22
23
# File 'lib/news_scraper/transformers/helpers/highscore_parser.rb', line 19

def keywords(url:, payload:)
  blacklist = Highscore::Blacklist.load(stopwords(url, payload))
  content = Readability::Document.new(payload, emove_empty_nodes: true, tags: [], attributes: []).content
  highscore(content, blacklist)
end