<commit_before>local insert = table.insert
local concat = table.concat
local assert = assert
local pairs = pairs
local rawset = rawset
local rawget = rawget
local setmetatable = setmetatable
local getmetatable = getmetatable
local type = type
local lower = string.lower
local upper = string.upper
local ngx_re = ngx.re

local normalize_exceptions = {
  etag = 'ETag'
}

local headers = {}
local headers_mt = {
  __newindex = function(table, key, value)
    rawset(table, headers.normalize_key(key), headers.normalize_value(value))
    return value
  end,
  __index = function(table, key)
    return rawget(table, headers.normalize_key(key))
  end
}

local regex_first_letter = [[^\w]]
local upper_first_match = function(matches) return upper(matches[0]) end

local capitalize = function(string)
  local str = ngx_re.sub(string, regex_first_letter, upper_first_match, 'jo')
  return str
end
<commit_msg>http_ng/headers: simplify capitalize method<commit_after>local insert = table.insert
local concat = table.concat
local assert = assert
local pairs = pairs
local rawset = rawset
local rawget = rawget
local setmetatable = setmetatable
local getmetatable = getmetatable
local type = type
local lower = string.lower
local upper = string.upper
local sub = string.sub
local ngx_re = ngx.re

local normalize_exceptions = {
  etag = 'ETag'
}

local headers = {}
local headers_mt = {
  __newindex = function(table, key, value)
    rawset(table, headers.normalize_key(key), headers.normalize_value(value))
    return value
  end,
  __index = function(table, key)
    return rawget(table, headers.normalize_key(key))
  end
}

local capitalize = function(string)
  return upper(sub(string, 1, 1)) .. sub(string, 2)
end

{'fraction_non_alphanumeric': 0.09362200117027501, 'fraction_numerical': 0.0023405500292568754, 'mean_word_length': 4.8561643835616435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '508488', 'n_tokens_mistral': 549, 'n_tokens_neox': 542, 'n_words': 159}