<commit_before>import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RunLengthEncoding {
    public String encode(String data) {
    	String encodedData = "";

    	for(int i = 0; i < data.length(); i++) {
    		char c = data.charAt(i);

    		if(i != 0 && c == data.charAt(i - 1)) continue;

    		int amt = 1;

    		for(int j = i+1; j < data.length() && c == data.charAt(j); j++) {
    			amt++;
    		}

    		if(amt == 1) encodedData += c;
    		else encodedData += amt + Character.toString(c);
    	}

    	return encodedData;
    }

    public String decode(String encodedData) {
    	String decodedData = "";
        Pattern pattern = Pattern.compile("[0-9]+|[a-zA-Z\s]");
        Matcher matcher = pattern.matcher(encodedData);

        while (matcher.find()) {
        	try {
	            int number = Integer.parseInt(matcher.group());
	        
	            matcher.find();
	        
	            while (number-- != 0) {
	                decodedData += matcher.group();
	            }
        	} catch(NumberFormatException e) {
        		decodedData+=matcher.group();
        	}
        }

        return decodedData;
    }
}<commit_msg>Fixed illegal escape<commit_after>import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RunLengthEncoding {
    public String encode(String data) {
    	String encodedData = "";

    	for(int i = 0; i < data.length(); i++) {
    		char c = data.charAt(i);

    		if(i != 0 && c == data.charAt(i - 1)) continue;

    		int amt = 1;

    		for(int j = i+1; j < data.length() && c == data.charAt(j); j++) {
    			amt++;
    		}

    		if(amt == 1) encodedData += c;
    		else encodedData += amt + Character.toString(c);
    	}

    	return encodedData;
    }

    public String decode(String encodedData) {
    	String decodedData = "";
        Pattern pattern = Pattern.compile("[0-9]+|[a-zA-Z\\s]");
        Matcher matcher = pattern.matcher(encodedData);

        while (matcher.find()) {
        	try {
	            int number = Integer.parseInt(matcher.group());
	        
	            matcher.find();
	        
	            while (number-- != 0) {
	                decodedData += matcher.group();
	            }
        	} catch(NumberFormatException e) {
        		decodedData+=matcher.group();
        	}
        }

        return decodedData;
    }
}
{'fraction_non_alphanumeric': 0.14388794567062818, 'fraction_numerical': 0.007640067911714771, 'mean_word_length': 1.8329326923076923, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4824722', 'n_tokens_mistral': 803, 'n_tokens_neox': 753, 'n_words': 160}