PrePAN

Sign in to PrePAN

Gram::Index Trigram index of files

Author
benkasminbullock@github
Date
URL
Status
In Review
Good

Synopsis

use Gram::Index;
my $gi = Gram::Index->new ();
$gi->index_file ('file-name');
$gi->write ('index.tri');

my $gr = Gram::Index->new ();
$gr->read ('index.tri');
my $files = $gr->search_string ($search_string);
for my $file (@$files) {
     my $text = slurp ($file);
     if ($text =~ /\Q$search_string/) {
          print "Found in $file.\n";
     }
}

Description

I've been developing a C program which indexes files by making trigrams of the contents of files. It's working reasonably well now and I'm thinking of extending it to a Perl version which could be used to index files, database entries and other things.

Comments

Please sign up to post a review.