<commit_before>#!/usr/bin/perl

use CrushWrapper;
use Config::General;
use Tie::DxHash;
tie my %conf, "Tie::DxHash";

my $wrap = new CrushWrapper::CrushWrapper;

$wrap->create();

%conf = Config::General::ParseConfig( -ConfigFile => "sample.txt", -Tie => "Tie::DxHash" );

my $arr = \%conf;

use Data::Dumper;

print Dumper $arr;


=item
@nums = (
    1, -4, 11, 17, 1, -92, -15, 48
    );

print "length: " . scalar(@nums) ."\n";
($result, $min, $max, $avg) = $wrap->add_bucket('1','1','1',scalar(@nums),\@nums,\@nums);

print join(" : ", ($result, $min, $max, $avg) );
print "\n";
=cut

<commit_msg>start of crush map manip from perl<commit_after>#!/usr/bin/perl

use CrushWrapper;
use Config::General;
use Tie::DxHash;
use Data::Dumper;

tie my %conf, "Tie::DxHash";

my $wrap = new CrushWrapper::CrushWrapper;

$wrap->create();

%conf = Config::General::ParseConfig( -ConfigFile => "sample.txt", -Tie => "Tie::DxHash" );

my $arr = \%conf;
my @ritems;

#print Dumper $arr;
@nums = (1, -4, 11, 17, 1, -92, -15, 48);
print "length: " . scalar(@nums) ."\n";

#print Dumper $arr;

#first argument must be zero for auto bucket_id
my $i=0;
foreach my $osd (keys %{$arr->{'osd'}}) {
	$ritems[$i] = $wrap->add_bucket(0,4,0,0,[],[]);
	$wrap->set_item_name($ritems[$i], $osd);
	print "bucket_id: $ritems[$i]\n";
	print $wrap->get_item_name($ritems[$i]) ."\n";
	$i++;
}

print Dumper @ritems;




=item

/*** BUCKETS ***/
enum {
    CRUSH_BUCKET_UNIFORM = 1,
    CRUSH_BUCKET_LIST = 2,
    CRUSH_BUCKET_TREE = 3,
    CRUSH_BUCKET_STRAW = 4
};

/*** RULES ***/
enum {
    CRUSH_RULE_NOOP = 0,
    CRUSH_RULE_TAKE = 1,          /* arg1 = value to start with */
    CRUSH_RULE_CHOOSE_FIRSTN = 2, /* arg1 = num items to pick */
                                  /* arg2 = type */
    CRUSH_RULE_CHOOSE_INDEP = 3,  /* same */
    CRUSH_RULE_EMIT = 4           /* no args */
};

=cut
{'fraction_non_alphanumeric': 0.20909090909090908, 'fraction_numerical': 0.02459893048128342, 'mean_word_length': 3.433649289099526, 'pattern_counts': {'":': 0, '<': 3, '<?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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5134996', 'n_tokens_mistral': 824, 'n_tokens_neox': 786, 'n_words': 180}