<commit_before>require "nokogiri"
require "open-uri"

class Letterpress

    def words_containing(letters)
        doc = Nokogiri::HTML(open("http://www.wordhippo.com/what-is/words-containing/#{letters}.html"))
        return nil if doc.text.match("No words found")
        doc.text.split("
    end

end<commit_msg>Finished words_containing method. Huzzah for scraping<commit_after>require "nokogiri"
require "open-uri"

class Letterpress
    def words_containing(letters)
        doc = Nokogiri::HTML(open("http://www.wordhippo.com/what-is/words-containing/#{letters}.html"))
        return nil if doc.text.match("No words found")
        words = doc.text.split("Words Found")[1].split("Search Again!")[0].split
        i = 2
        while true
            doc = Nokogiri::HTML(open("http://www.wordhippo.com/what-is/words-containing/#{letters}.html?page=#{i}"))
            break if doc.text.match("No words found")
            words += doc.text.split("Words Found")[1].split("Search Again!")[0].split
            i += 1
        end
        words
    end
end
{'fraction_non_alphanumeric': 0.1481132075471698, 'fraction_numerical': 0.005660377358490566, 'mean_word_length': 2.958955223880597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, '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': '1249365', 'n_tokens_mistral': 350, 'n_tokens_neox': 333, 'n_words': 64}