<commit_before>import java.util.ArrayList;
import java.util.Set;
import java.util.List;

public abstract class Compound {
	/**
	 * @param idgs
	 *          All compounds to check reactivity with including its self
	 * @return all if no reactions are detected else a new List containing the
	 *         compounds after reaction.
	 */
	private int timeToLive = 0;
	private boolean stable = true;

	public abstract String toStringSimple();

	public String toStringNoNums() {
		String s = toStringSimple();
		for (int i = 0; i < timeToLive; i++)
			s = "U" + s;
		return s;
	}

	public String toString() {
		return letersToNumbers(toStringNoNums());
	}

	static String letersToNumbers(String s) {
		System.out.println(s);
		List<String> tokens = tokenize(s);
		for (String token : tokens)
			System.out.println(token);
		System.out.println("End of tokens");
		int count = 1;
		String r = "";
		String last = tokens.get(0);
		for (int j = 1; j < tokens.size(); j++) {
			String next = tokens.get(j);
			if (next.equals(")") || next.equals("(")) {
				r += next;
				if (count == 1) {
					r += last;
				} else {
					r += count + last;
				}
				last = next;
			} else if (next.equals(last)) {
				count++;
			} else {
				if (count == 1) {
					r += last;
				} else {
					r += count + last;
				}
				last = next;
				count = 1;
			}
			System.out.println(r);
		}
		if (count == 1) {
			return r + last;
		} else {
			return r + count + last;
		}
	}

	/**
	 * @param s
	 * @return
	 */
	private static List<String> tokenize(String s) {
		List<String> tokens = new ArrayList<String>();
		int i = 0;
		// Separate the string into tokens.
		while (i < s.length()) {
			String token = "" + s.charAt(i++);
			if (token.equals(")") || token.equals((")"))) {
				tokens.add(token);
				i++;
			} else if (token.equals("\"")) {
				while (i < s.length() && s.charAt(i) != '"') {
					token += s.charAt(i++);
				}
				token += s.charAt(i++);
			} else {
				while (i < s.length() && Character.isLowerCase(s.charAt(i))) {
					token += s.charAt(i++);
				}
			}
			tokens.add(token);
		}
		return tokens;
	}

	public boolean react(Set<Compound> idgs) {
		return false;
	}

	/**
	 * @return weather it survived
	 */
	public boolean tick() {
		if (stable) {
			return true;
		}<commit_msg>Redid letersToNumbers<commit_after>import java.util.ArrayList;
import java.util.Set;
import java.util.List;

public abstract class Compound {
	static private class Token {
		public String s;
		public int times = 1;

		public Token(String s) {
			this.s = s;
		}

		public String toString() {
			if (times == 1)
				return s;
			return times + s;
		}
	}

	private int timeToLive = 0;
	private boolean stable = true;

	public abstract String toStringSimple();

	public String toStringNoNums() {
		String s = toStringSimple();
		for (int i = 0; i < timeToLive; i++)
			s = "U" + s;
		return s;
	}

	public String toString() {
		return letersToNumbers(toStringNoNums());
	}

	static String letersToNumbers(String s) {
		List<Token> tokens = tokenize(s);
		for (int i = tokens.size() - 1; i > 0; i--) {
			boolean numberable = tokens.get(i).s.matches("[a-zA-Z]+");
			if (numberable && tokens.get(i).s.equals(tokens.get(i - 1).s)) {
				tokens.get(i - 1).times += tokens.get(i).times;
				tokens.remove(i);
			}
		}
		String r = "";
		for (Token t : tokens) {
			r += t;
		}
		return r;
	}

	/**
	 * @param s
	 * @return
	 */
	private static List<Token> tokenize(String s) {
		List<Token> tokens = new ArrayList<Token>();
		int i = 0;
		// Separate the string into tokens.
		while (i < s.length()) {
			String t = "" + s.charAt(i++);
			if (t.equals(")") || t.equals((")"))) {
				tokens.add(new Token(t));
				i++;
			} else if (t.equals("\"")) {
				while (i < s.length() && s.charAt(i) != '"') {
					t += s.charAt(i++);
				}
				t += s.charAt(i++);
			} else {
				while (i < s.length() && Character.isLowerCase(s.charAt(i))) {
					t += s.charAt(i++);
				}
			}
			tokens.add(new Token(t));
		}
		return tokens;
	}

	/**
	 * @param idgs
	 *          All compounds to check reactivity with including its self
	 * @return idgs if no reactions are detected else a new Set containing the
	 *         compounds after reaction.
	 */

	public boolean react(Set<Compound> idgs) {
		return false;
	}

	/**
	 * @return weather it survived
	 */
	public boolean tick() {
		if (stable) {
			return true;
		}
{'fraction_non_alphanumeric': 0.1664761033615367, 'fraction_numerical': 0.004344843356963183, 'mean_word_length': 2.620860927152318, 'pattern_counts': {'":': 0, '<': 22, '<?xml version=': 0, '>': 14, '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': '4847364', 'n_tokens_mistral': 1829, 'n_tokens_neox': 1537, 'n_words': 428}