<commit_before>pub mod base62 {
    const BASE: i32 = 62;
    const ALPHABET: [char; BASE as usize] = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
                                               'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
                                               'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
                                               'v', 'w', 'x', 'y', 'z'];

    pub fn encode(mut num: i32) -> String {
        let mut result: String = "".to_string();

        while num > 0 {
            let char_holder = ALPHABET.get((num % BASE) as usize).unwrap().to_string();
            result = char_holder + &result;
            num /= BASE
        }

        return result.to_string();
    }

    pub fn decode(string: &str) -> i32 {
        let mut result = 0;

        for (i, c) in string.chars().rev().enumerate() {
            let num = BASE.pow(i as u32);
            result += ALPHABET.iter().position(|x| *x == c).unwrap() as i32 * num;
        }

        return result;
    }
}

#[test]
fn it_encodes() {
    assert_eq!(base62::encode(1337), "LZ");
}

#[test]
fn it_decodes() {
    assert_eq!(base62::decode("LZ"), 1337);
}
<commit_msg>minor improvements<commit_after>pub mod base62 {
    const BASE: u64 = 62;
    const ALPHABET: [char; BASE as usize] =
        ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
        'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
        'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
        'v', 'w', 'x', 'y', 'z'];

    pub fn encode(mut num: u64) -> String {
        if num == 0 { return "0".to_string() }
        let mut result  = String::new();

        while num > 0 {
            let char_holder = ALPHABET[(num % BASE) as usize].to_string();
            result = char_holder + &result;
            num /= BASE
        }

        return result.to_string();
    }

    pub fn decode(string: &str) -> u64 {
        let mut result = 0;

        for (i, c) in string.chars().rev().enumerate() {
            let num = BASE.pow(i as u32);
            result += ALPHABET.iter().position(|x| *x == c).unwrap() as u64 * num;
        }

        return result;
    }
}

#[test]
fn it_encodes() {
    assert_eq!(base62::encode(1337), "LZ");
}

#[test]
fn it_decodes() {
    assert_eq!(base62::decode("LZ"), 1337);
}

{'fraction_non_alphanumeric': 0.2534722222222222, 'fraction_numerical': 0.03009259259259259, 'mean_word_length': 1.923337091319053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '852019', 'n_tokens_mistral': 1044, 'n_tokens_neox': 1008, 'n_words': 285}