<commit_before>#load "utils.fs"

open Utils

let profileParse (s: string) =
    let pairs = s.Split([|'&'; '='|])
    let e = Array.length pairs - 1
    [| for i in [0..e]
           do if i % 2 = 0 then yield (pairs.[i], pairs.[i+1]) |]
    |> Map.ofArray

let encodeEmail (email: string) =
    let s = String.concat "" ["email="; email; "&uid=10&role=user"]
    profileParse s
                       <commit_msg>sanitize email<commit_after>#load "utils.fs"

open Utils

let profileParse (s: string) =
    let elems = s.Split([|'&'; '='|])
    let e = Array.length elems - 1
    [| for i in [0..e]
           do if i % 2 = 0 then yield (elems.[i], elems.[i+1]) |]
    |> Map.ofArray

let encodeEmail (email: string) =
    let sanitized =
        let elems = email.Split([|'@'; '&'; '='|])
        if Array.length elems > 2 then elems.[0] else email
    let s = String.concat "" ["email="; sanitized; "&uid=10&role=user"]
    profileParse s
                       
{'fraction_non_alphanumeric': 0.17738589211618258, 'fraction_numerical': 0.016597510373443983, 'mean_word_length': 2.2711864406779663, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '1590923', 'n_tokens_mistral': 359, 'n_tokens_neox': 344, 'n_words': 98}