AI-MicroStructure
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
bin/micro-relation-test view on Meta::CPAN
#!/usr/bin/perl -X
use JSON;
use JSON::XS;
use Data::Printer;
use Data::Dumper;
use WWW::Wikipedia;
use Try::Tiny;
my $lang = $ENV{MICRO_LANG} || "en" ;
my $wiki = WWW::Wikipedia->new(language => $lang);
use Cache::Memcached::Fast;
my $memd = new Cache::Memcached::Fast({
servers => [ { address => 'localhost:11211', weight => 2.5 }],
namespace => 'my:',
connect_timeout => 0.2,
io_timeout => 0.5,
close_on_error => 1,
compress_threshold => 100_000,
compress_ratio => 0.9,
compress_methods => [ \&IO::Compress::Gzip::gzip,
\&IO::Uncompress::Gunzip::gunzip ],
max_failures => 3,
failure_timeout => 2,
ketama_points => 150,
nowait => 1,
hash_namespace => 1,
serialize_methods => [ \&Storable::freeze, \&Storable::thaw ],
utf8 => ($^V ge v5.8.1 ? 1 : 0),
max_size => 512 * 1024,
});
sub decruft {
my($file) = @_;
my($cruftSet) = q{%ç&|#[^+*(]),'";};
my $clean = $file;
$clean=~s/\Q$_//g for split("",$cruftSet);
return $clean;
}
sub rel {
my ($arg,$lang) = @_;
my $result = $wiki->search($arg);
my $str = "";
if (defined($result) && $result->text() ) {
$str = join( "\n", $result->related() );
}
return $str;
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.215 second using v1.00-cache-2.02-grep-82fe00e-cpan-eb20b53101e )