def run_tests(rule_regexes, evidences, answers):
    predictions = []
    real_labels = []
    evidences_with_labels = []

    colorama_init()
    formatter = TerminalEvidenceFormatter()

    for name, regex, answer in rule_regexes:
        title = "Matches for rule '{}' (value: {})".format(name, answer)
        print("\n{}\n{}".format(title, "-" * len(title)))

        anything_matched = False
        for evidence in evidences:
            tokens_to_match = generate_tokens_to_match(evidence)
            match = refo.match(regex, tokens_to_match)

            if match:
                anything_matched = True
                print("  * {}".format(formatter.colored_text(evidence)))

            if evidence in answers and answers[evidence] is not None:
                evidences_with_labels.append(evidence)
                real_labels.append(answers[evidence])

                if match:
                    predictions.append(answer)
                else:
                    predictions.append(False)

        if not anything_matched:
            print("  nothing matched")

        print()

    if real_labels:
        results = result_dict_from_predictions(
            evidences_with_labels, real_labels, predictions
        )
        results.pop("end_time")
        keys = [
            "true_positives", "true_negatives",
            "false_positives", "false_negatives",
            "precision", "recall",
            "accuracy", "f1",
        ]

        title = "Metrics"
        print("{}\n{}".format(title, "-" * len(title)))
        for key in keys:
            print("{:>15}: {:.2f}".format(key, results[key]))
dataset/ETHPy150Open machinalis/iepy/iepy/instantiation/rules_verifier.py/run_tests/original