AI-Gene-Sequence

 view release on metacpan or  search on metacpan

demo/spamscan.pl  view on Meta::CPAN

# which are quite good at spotting spam.

use strict;
use warnings;
use Regexgene;

my $num_mutates = 3;

# read in our passes and failures.
my (@wanted, @spam);
while (<DATA>) {
  if (1../^$/) { push @wanted, $_;}
  else         { push @spam, $_}
}
print "Best score possible is: ", scalar(@spam), "\n";

my $regex = seed_match(); # start off with something quite good
my $best_yet = 0;
my $temp = 1;
while (1) {
  my $child = $regex->clone;           # copy the parent

demo/spamscan.pl  view on Meta::CPAN

  my $regex;
 TWIDDLE: while (1) {
    $regex = Regexgene->new(5);
    my $rg = $regex->regex;
    last TWIDDLE if $spam[rand@spam] =~ $rg;
  }
  return $regex;
}

# Stuff from my mailbox (Don't ask) and my spam trap
__DATA__;
Stats since whenever
Hello
Bit of Fun
Money 
oxford
The sound of one hand clapping
Silly Americans
Saturday
Mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm!
I've just written 4000 words with twenty diagrams in six hours.



( run in 0.896 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )