/[nn.old]/trunk/vector/index.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/vector/index.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 104 - (show annotations)
Tue Feb 22 17:44:48 2005 UTC (19 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 694 byte(s)
experiment with vector search engine Search::ContextGraph

1 #!/usr/bin/perl -wT
2
3 use Search::ContextGraph;
4 use GDBM_File;
5 use Term::ProgressBar;
6
7 my $gdbm_file = '../swish/file2title.gdbm';
8 my $graph_file = 'stored.cng';
9
10 my %gdbm_file;
11 tie %gdbm_file, 'GDBM_File', $gdbm_file, &GDBM_READER, 0640;
12
13 my $cg = Search::ContextGraph->new();
14
15 my @docs = keys %gdbm_file;
16
17 my $i = 0;
18 my $max = $#docs;
19
20 my $progress = Term::ProgressBar->new ({
21 name => 'Indexing',
22 ETA => 'linear',
23 count => $max,
24 });
25
26 my $next_update = 0;
27
28 foreach (@docs) {
29 $cg->add( $_, [ split(/\s+/,$gdbm_file{$_}) ] );
30
31 $i++;
32 $next_update = $progress->update($i) if ($i > $next_update);
33 }
34
35 $progress->message("Saving to '$graph_file'");
36 $cg->store( $graph_file );
37
38 untie %gdbm_file;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26