<commit_before>class Wotd::Word
  attr_accessor :wotd, :definition, :example, :fact

  def self.today
    word = []
    word << self.scrape_word
    word
  end

  def self.scrape_word
    # go to site, find wotd
    # extract properties
    # instantiate word
    doc = Nokogiri::HTML(open("http://www.merriam-webster.com/word-of-the-day"))
    word = self.new
    word.wotd = doc.search("h1").last.text
    word.definition = doc.search("div.wod-definition-container p").first.text
    word.example = doc.search("div.wod-definition-container p")[1].children.text
    word.fact = doc.search("div.wod-did-you-know-container p").text
    word
  end

end<commit_msg>update scrape method, fix issue when site offers two definitions<commit_after>class Wotd::Word
  attr_accessor :wotd, :definition, :example, :fact

  def self.today
    word = []
    word << self.scrape_word
    word
  end

  def self.scrape_word
    # go to site, find wotd
    # extract properties
    # instantiate word
    doc = Nokogiri::HTML(open("http://www.merriam-webster.com/word-of-the-day"))
    word = self.new
    word.wotd = doc.search("h1").last.text
    word.definition = doc.search( '//h2[text()="Definition"]/following::p[not(preceding::h2[text()="Examples"])]' ).text
    word.example = doc.search('//*[preceding-sibling::h2[2]]').first.text
    word.fact = doc.search("div.wod-did-you-know-container p").text
    word
  end

end
{'fraction_non_alphanumeric': 0.15095676824946846, 'fraction_numerical': 0.004961020552799433, 'mean_word_length': 3.3446153846153845, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1497906', 'n_tokens_mistral': 515, 'n_tokens_neox': 497, 'n_words': 94}