AI-MicroStructure
view release on metacpan or search on metacpan
max_failures => 1,
max_size => 512 * 1024,
});
if(!$#ARGV){
push @ARGV,"any";
}
if($kkey =~ /debug/){
my $NORMAL=`tput sgr0`;
my $REVERSE=`tput smso`;
print "$REVERSE $_ $NORMAL " for @ARGV;
print "\n";
}else{
}
if(defined(my $ret = $memd->get($argkey)) && ($kkey !~ m/(any|structures)/i) && @ARGV){
print "$ret\n";
bin/micro-sense view on Meta::CPAN
use Data::Dumper;
use JSON;
use AI::MicroStructure::WordBlacklist;
my @set;
my $data = {};
my %structure;
my $fresh=1;
my $wn;
my $debug = 0;
my $words = 1;
my $count = 0;
if( grep{/\bdebug\b/} @ARGV ){$debug = 1; cleanArgs("debug"); };
if( grep{/\bwords\b/} @ARGV ){$words = 1; cleanArgs("words"); };
sub cleanArgs{
my ($key) = @_;
my @tmp=();
foreach(@ARGV){
push @tmp,$_ unless($_=~/$key/);}
@ARGV=@tmp;
bin/micro-sense view on Meta::CPAN
#push @{$data->{'coordinate'}},map{$_=trim($_); @_=grep(/[A-Z]|[0-9]|[a-z]/,map{$_=trim($_)}split("\n|=>",$_))}split(/Sense/,`wn $line -coorn`) unless(!$words);
#shift @{$data->{'coordinate'}} && shift @{$data->{'search'}} for(0..1);
#@{$data->{'search'}};
END{
$data = {"rows"=>$data,"senses"=>[sort keys %{$data->{'senses'}}]};
my $utf8_encoded_json_text = encode_json($data);
if($debug == 1) {
print Dumper $data,$wn;
}
print $utf8_encoded_json_text;
}
#cleanup
eval { unlink $path; };
ok( !length $@, "remove stored file" );
($docs, $words ) = $cg->find_similar('First Document');
is(sprintf("%2.2f", $docs->{"First Document"}), 122.34, 'reloaded search object works fine');
}
my $y = Search::ContextGraph->new( debug => 1, xs => $XS );
$path = sprintf("$PWD/t/canned/sample.tdm");
$y->load_from_tdm( $path );
ok( !length $@, "able to load TDM file $@" );
is( $y->doc_count(), 177, "correct document count" );
is( $y->term_count(), 2036, "correct term count" );
($docs, $words) = $y->mixed_search( { terms => [ 111, 109, 23 ], docs => [33,21,12] });
is( scalar keys %$words,141, "Got right number of results");
is(sprintf("%2.2f", $docs->{163}), 1.09, "mixed search got right doc value");
( run in 1.173 second using v1.01-cache-2.11-cpan-49f99fa48dc )