<commit_before>#!/usr/bin/env python3

import sys
import re
from gmpy2 import mpq as Fraction
from quadratic import Quadratic
from solver.integral import IntegralTchisla
from solver.rational import RationalTchisla
from solver.quadratic import QuadraticTchisla

integral_re = re.compile("^\\d+$")
rational_re = re.compile("^\\d+(/\\d+)?$")
number_re = rational_re

solvers = {
    "integral": [
        {"regex": integral_re, "constructor": int, "solver": IntegralTchisla}
    ],
    "rational": [
        {"regex": rational_re, "constructor": Fraction, "solver": RationalTchisla}
    ],
    "quadratic": [
        {"regex": rational_re, "constructor": Quadratic, "solver": QuadraticTchisla}
    ],
    "incremental": [
        {"regex": integral_re, "constructor": int, "solver": IntegralTchisla},
        {"regex": rational_re, "constructor": Fraction, "solver": RationalTchisla},
        {"regex": rational_re, "constructor": Quadratic, "solver": QuadraticTchisla}
    ]
}

def general_solver(n, target, solver_type, max_depth = None):
    depth = max_depth and max_depth + 1
    solution = None
    for solver in solvers[solver_type]:
        if not solver["regex"].match(target):
            continue
        current_target = solver["constructor"](target)
        tchisla = solver["solver"](n, current_target)
        max_depth = depth
        depth = tchisla.solve(max_depth)
        if depth is None:
            depth = max_depth
            continue
        if solution:<commit_msg>remove quadratic solver from incremental solver<commit_after>#!/usr/bin/env python3

import sys
import re
from gmpy2 import mpq as Fraction
from quadratic import Quadratic
from solver.integral import IntegralTchisla
from solver.rational import RationalTchisla
from solver.quadratic import QuadraticTchisla

integral_re = re.compile("^\\d+$")
rational_re = re.compile("^\\d+(/\\d+)?$")
number_re = rational_re

solvers = {
    "integral": [
        {"regex": integral_re, "constructor": int, "solver": IntegralTchisla}
    ],
    "rational": [
        {"regex": rational_re, "constructor": Fraction, "solver": RationalTchisla}
    ],
    "quadratic": [
        {"regex": rational_re, "constructor": Quadratic, "solver": QuadraticTchisla}
    ],
    "incremental": [
        {"regex": integral_re, "constructor": int, "solver": IntegralTchisla},
        {"regex": rational_re, "constructor": Fraction, "solver": RationalTchisla}
    ]
}

def general_solver(n, target, solver_type, max_depth = None):
    depth = max_depth and max_depth + 1
    solution = None
    for solver in solvers[solver_type]:
        if not solver["regex"].match(target):
            continue
        current_target = solver["constructor"](target)
        tchisla = solver["solver"](n, current_target)
        max_depth = depth
        depth = tchisla.solve(max_depth)
        if depth is None:
            depth = max_depth
            continue
        if solution:
{'fraction_non_alphanumeric': 0.12568306010928962, 'fraction_numerical': 0.0020491803278688526, 'mean_word_length': 3.3456973293768546, 'pattern_counts': {'":': 41, '<': 3, '<?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': '2284597', 'n_tokens_mistral': 970, 'n_tokens_neox': 927, 'n_words': 226}