<commit_before>package ir.pi0.irproject.utils;

import ir.pi0.irproject.structures.FastDict;

import java.util.HashMap;
import java.util.Map;

public class Normalizer {

    Character[][] _tans_map = {
            {'ك', 'ک'},
            {'ي', 'ی'},
    };

    String tans_to_space_map = "?.*()!%-/:<>',،;\"\n\t" +
            "؛٪«»؟" +
            " "/*Half space*/;


    Map<Character, Character> trans_map = new HashMap<>();

    String remove_chars_str = "0123456789۰۱۲۳۴۵۶۷۸۹\r";

    FastDict<Character> remove_chars;

    public Normalizer() {

        for (Character[] map : _tans_map) trans_map.put(map[0], map[1]);

        for (char c : tans_to_space_map.toCharArray())
            trans_map.put(c, ' ');

        remove_chars = new FastDict<>(
                Util.toCharacterArray(remove_chars_str), Character.class);

    }

    public String normalize(String input) {<commit_msg>Better normalazation<commit_after>package ir.pi0.irproject.utils;

import ir.pi0.irproject.structures.FastDict;

import java.util.HashMap;
import java.util.Map;

public class Normalizer {

    Character[][] _tans_map = {
            {'ك', 'ک'},
            {'ي', 'ی'},
    };

    String tans_to_space_map = "?.*[]{}()!%-/:<>',،;\\\"\n\t" +
            "؛٪«»؟" +
            " "/*Half space*/;


    Map<Character, Character> trans_map = new HashMap<>();

    String remove_chars_str = "0123456789۰۱۲۳۴۵۶۷۸۹\r" +
            "abcdefghijklmnopqrstuvwxyz" +
            "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

    FastDict<Character> remove_chars;

    public Normalizer() {

        for (Character[] map : _tans_map) trans_map.put(map[0], map[1]);

        for (char c : tans_to_space_map.toCharArray())
            trans_map.put(c, ' ');

        remove_chars = new FastDict<>(
                Util.toCharacterArray(remove_chars_str), Character.class);

    }

    public String normalize(String input) {
{'fraction_non_alphanumeric': 0.15864621893178213, 'fraction_numerical': 0.02538339502908514, 'mean_word_length': 2.5833333333333335, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '3095331', 'n_tokens_mistral': 721, 'n_tokens_neox': 675, 'n_words': 119}