<commit_before>local simplehttp = require'simplehttp'

local cache = {}
local trim = function(s)
	return s:match('^%s*(.-)%s*$')
end

local pattern = ('<td[^>]*>([^\n]+)\n[^<]+'):rep(10)
local parseData = function(data)
	local tmp = {}
	local tbody = data:match('<tbody>(.*)</tbody>')
	for row in tbody:gmatch('<tr[^>]+>.-</tr>') do
		for _, name, class, rarity, kind, race, mana, attack, life, desc in row:gmatch(pattern) do
			-- Strip HTML:
			name = name:gsub('<%/?[%w:]+.-%/?>', '')
			class = class:match('alt="([^"]+)"') or class

			tmp[name:lower()] = {
				name = name,
				class = class,
				rarity = rarity:sub(1, -6),
				type = kind:sub(1, -6),
				race = race ~= "" and race:sub(1, -6) or nil,
				mana = mana ~= "" and mana:sub(1, -6) or nil,
				attack = attack ~= "" and attack:sub(1, -6) or nil,
				life = life ~= "" and attack:sub(1, -6) or nil,
				desc = desc ~= "" and desc:sub(1, -6) or nil,
			}
		end<commit_msg>hearthstone: Fix output for class='All'.<commit_after>local simplehttp = require'simplehttp'

local cache = {}
local trim = function(s)
	return s:match('^%s*(.-)%s*$')
end

local pattern = ('<td[^>]*>([^\n]+)\n[^<]+'):rep(10)
local parseData = function(data)
	local tmp = {}
	local tbody = data:match('<tbody>(.*)</tbody>')
	for row in tbody:gmatch('<tr[^>]+>.-</tr>') do
		for _, name, class, rarity, kind, race, mana, attack, life, desc in row:gmatch(pattern) do
			-- Strip HTML:
			name = name:gsub('<%/?[%w:]+.-%/?>', '')
			class = class:match('alt="([^"]+)"') or class:sub(1, -6)

			tmp[name:lower()] = {
				name = name,
				class = class,
				rarity = rarity:sub(1, -6),
				type = kind:sub(1, -6),
				race = race ~= "" and race:sub(1, -6) or nil,
				mana = mana ~= "" and mana:sub(1, -6) or nil,
				attack = attack ~= "" and attack:sub(1, -6) or nil,
				life = life ~= "" and attack:sub(1, -6) or nil,
				desc = desc ~= "" and desc:sub(1, -6) or nil,
			}
		end
{'fraction_non_alphanumeric': 0.24425887265135698, 'fraction_numerical': 0.017745302713987474, 'mean_word_length': 3.396788990825688, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2847605', 'n_tokens_mistral': 853, 'n_tokens_neox': 768, 'n_words': 194}