<commit_before>-module(keylist).
-export([fetch/2, from_list/1, append/2, prepend/2,
	 delete/2, deletefirstvalue/2, set/3, copy/2, appendlist/2, map/2]).

-record(keylist, {list}).
-record(keyelem, {key, casekey, item}).

to_lower(Key) when list(Key) ->
    httpd_util:to_lower(Key);
to_lower(Key) ->
    Key.

to_lower_list(Keys) ->
    lists:map(fun(Key) ->
		      to_lower(Key)
	      end, Keys).

fetch(Key, List) when record(List, keylist) ->
    fetchcase(to_lower(Key), List#keylist.list);
fetch(Key, List) ->
    erlang:fault("Keylist not wellformed", [Key, List]).

fetchcase(Key, []) -><commit_msg>handle compact headers defined in RFC3261 and RFC3515<commit_after>-module(keylist).
-export([fetch/2, from_list/1, append/2, prepend/2,
	 delete/2, deletefirstvalue/2, set/3, copy/2, appendlist/2, map/2]).

-record(keylist, {list}).
-record(keyelem, {key, casekey, item}).

% This is to support the compact headers we are required to support
% by RFC3261 7.3.3.
to_lower("i") -> "call-id";
to_lower("m") -> "contact";
to_lower("e") -> "content-encoding";
to_lower("l") -> "content-length";
to_lower("c") -> "contact-type";
to_lower("f") -> "from";
to_lower("s") -> "subject";
to_lower("k") -> "supported";
to_lower("t") -> "to";
to_lower("v") -> "via";
% RFC3515 #7
to_lower("r") -> "refer-to";
to_lower(Key) when list(Key) ->
    httpd_util:to_lower(Key);
to_lower(Key) ->
    Key.

to_lower_list(Keys) ->
    lists:map(fun(Key) ->
		      to_lower(Key)
	      end, Keys).

fetch(Key, List) when record(List, keylist) ->
    fetchcase(to_lower(Key), List#keylist.list);
fetch(Key, List) ->
    erlang:fault("Keylist not wellformed", [Key, List]).

fetchcase(Key, []) ->
{'fraction_non_alphanumeric': 0.20404521118381916, 'fraction_numerical': 0.02379535990481856, 'mean_word_length': 4.22360248447205, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 28, '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': '1241636', 'n_tokens_mistral': 675, 'n_tokens_neox': 658, 'n_words': 132}