<commit_before>#!/usr/bin/perl

use Modern::Perl;

use File::Basename;
use File::Slurp;
use Getopt::Compact;
use String::Util qw/trim/;
use Time::HiRes qw/time/;

my $script_path = dirname(__FILE__);

my $options = Getopt::Compact->new(
	name => 'checker if the output of aig2qbf is ok',
	struct => [
		[ 'input', 'Input aig file to check', '=s' ],
		[ 'k', 'Unrolling step k', ':i' ],
		[ 'no-reduction', 'Do not apply any reduction' ],
		[ 'no-sanity', 'Do not do any sanity checks' ],
		[ 'verbose', 'Verbose output' ],
	]
);

my $opts = $options->opts();

sub options_validate {
	if (not $opts->{input}) {
		return;
	}

	if ($opts->{k} and $opts =~ m/^\d+$/) {
		return;
	}

	return 1;
}

if (not $options->status() or not options_validate()) {
	say $options->usage();

	exit 7;
}

my $file = $opts->{input};
my @ks = ($opts->{k}) ? ($opts->{k}) : (1..10);

if (not -f "$script_path/../build/classes/at/jku/aig2qbf/aig2qbf.class") {
	print "Cannot find aig2qbf class. aig2qbf not built into folder 'build'!\n";

	exit 5;
}

if ($opts->{verbose}) {<commit_msg>convert .cnf to .aig in checker<commit_after>#!/usr/bin/perl

use Modern::Perl;

use File::Basename;
use File::Slurp;
use Getopt::Compact;
use String::Util qw/trim/;
use Time::HiRes qw/time/;

my $script_path = dirname(__FILE__);

my $options = Getopt::Compact->new(
	name => 'checker if the output of aig2qbf is ok',
	struct => [
		[ 'input', 'Input aig/cnf file to check', '=s' ],
		[ 'k', 'Unrolling step k', ':i' ],
		[ 'no-reduction', 'Do not apply any reduction' ],
		[ 'no-sanity', 'Do not do any sanity checks' ],
		[ 'verbose', 'Verbose output' ],
	]
);

my $opts = $options->opts();

sub options_validate {
	if (not $opts->{input}) {
		return;
	}

	if ($opts->{k} and $opts =~ m/^\d+$/) {
		return;
	}

	return 1;
}

if (not $options->status() or not options_validate()) {
	say $options->usage();

	exit 7;
}

my $file = $opts->{input};

if ($file =~ m/\.cnf$/) {
	my $cnf2aig_out = `"$script_path/../tools/cnf2aig" "$file" "$file-aig.aig"`;
	
	if ($opts->{verbose}) {
		say $cnf2aig_out;
	}
	
	$file = "$file-aig.aig";
}

my @ks = ($opts->{k}) ? ($opts->{k}) : (1..10);

if (not -f "$script_path/../build/classes/at/jku/aig2qbf/aig2qbf.class") {
	print "Cannot find aig2qbf class. aig2qbf not built into folder 'build'!\n";

	exit 5;
}

if ($opts->{verbose}) {
{'fraction_non_alphanumeric': 0.21808054841473865, 'fraction_numerical': 0.010711225364181662, 'mean_word_length': 3.651394422310757, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 28, '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': '459751', 'n_tokens_mistral': 1019, 'n_tokens_neox': 973, 'n_words': 247}