/[webpac]/trunk2/all2all.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

Diff of /trunk2/all2all.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 490 by dpavlin, Sat Oct 9 21:44:25 2004 UTC revision 530 by dpavlin, Tue Oct 19 17:43:52 2004 UTC
# Line 32  my $result = GetOptions( Line 32  my $result = GetOptions(
32          "low_mem!"      => \$low_mem,          "low_mem!"      => \$low_mem,
33  );  );
34    
35    my $filter = {
36            'CROVOC' => sub {
37                    my $tmp = shift || return;
38                    return undef unless ($tmp =~ s/\s*CROVOC.*$/ */);
39                    return $tmp;
40            },
41            'CROVOC_tree' => sub {
42                    my $tmp = shift || return;
43                    $tmp =~ s/\s*CROVOC.*$/ */;
44                    $tmp =~ s/\s*EUROVOC.*//;
45                    return $tmp;
46            },
47    };
48    
49  # create WebPAC object  # create WebPAC object
50  #  #
51  my $webpac = new WebPAC(  my $webpac = new WebPAC(
# Line 40  my $webpac = new WebPAC( Line 54  my $webpac = new WebPAC(
54          start_mfn => $start_mfn,          start_mfn => $start_mfn,
55          debug => $debug,          debug => $debug,
56          low_mem => $low_mem,          low_mem => $low_mem,
57            filter => $filter,
58  ) || die;  ) || die;
59    
60  my $log = $webpac->_get_logger() || die "can't get logger";  my $log = $webpac->_get_logger() || die "can't get logger";
# Line 58  $|=1; Line 73  $|=1;
73  my $maxmfn = $webpac->open_isis(  my $maxmfn = $webpac->open_isis(
74          filename => shift @ARGV || '/data/hidra/THS/THS',          filename => shift @ARGV || '/data/hidra/THS/THS',
75          lookup => [          lookup => [
76          { 'key' => 'd:v900', 'val' => 'v250^a' },          { 'key' => 'd:v900', 'val' => 'filter{CROVOC_tree}v250^a v800' },
77  #       { 'eval' => '"v901^a" eq "Područje"', 'key' => 'pa:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval' => '"v901^a" eq "Područje"', 'key' => 'pa:v561^4:v562^4:v461^1', 'val' => 'v900' },
78  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval '=> '"v901^a" eq "Mikrotezaurus"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
79  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },  #       { 'eval' => '"v901^a" eq "Deskriptor"', 'key' => 'a:v561^4:v562^4:v461^1', 'val' => 'v900' },
# Line 123  while (my $rec = $webpac->fetch_rec) { Line 138  while (my $rec = $webpac->fetch_rec) {
138                  $words =~ s/\W*\s+\W*/ /g;                  $words =~ s/\W*\s+\W*/ /g;
139                  $words =~ s/\W+$//;                  $words =~ s/\W+$//;
140    
141                    # first try to generate headline for this entry from index
142                    my $h = $ds->{'index'}->[0];
143                    # then, from display
144                    $h ||= $ds->{'display'}->[0];
145                    # and as last resport, fallback to headline
146                    $h ||= $headline;
147    
148                  $index->insert(                  $index->insert(
149                          index_name => $ds->{'tag'},                          index_name => $ds->{'tag'},
150                          #path => $f,                          #path => $f,
151                          path => $webpac->mfn,                          path => $webpac->mfn,
152                          headline => $headline,                          headline => $h,
153                          words => $words,                          words => $words,
154                  );                  );
155          }          }
# Line 136  while (my $rec = $webpac->fetch_rec) { Line 158  while (my $rec = $webpac->fetch_rec) {
158          foreach my $ds (@ds) {          foreach my $ds (@ds) {
159                  next if (! $ds->{'index'});                  next if (! $ds->{'index'});
160    
161                  $thes->{$ds->{'tag'}} ||= new WebPAC::Index;                  $thes->{$ds->{'tag'}} ||= new WebPAC::Index( name => $ds->{'tag'} );
162    
163                  foreach my $h (@{$ds->{'index'}}) {                  foreach my $h (@{$ds->{'index'}}) {
164                          $thes->{$ds->{'tag'}}->insert(                          $thes->{$ds->{'tag'}}->insert(
# Line 179  if (0 && $log->is_debug) { Line 201  if (0 && $log->is_debug) {
201    
202  } # XXX if(0)  } # XXX if(0)
203    
204  $log->debug("lookup hash: ",Dump($webpac->{'lookup'}));  #$log->debug("lookup hash: ",Dump($webpac->{'lookup'}));
205    
206  $log->info("creating tree");  $log->info("creating tree");
207    
# Line 288  my @tree = ({ Line 310  my @tree = ({
310  });  });
311    
312  my $tree = new WebPAC::Tree(  my $tree = new WebPAC::Tree(
313          dir => './out',          tree => \@tree,
314          html => 'browse.html',  );
315    
316    $tree->output(
317            dir => './out',
318            html => 'browse.html',
319          template => './output_template/tree.tt',          template => './output_template/tree.tt',
320          js => 'tree-ids.js',          js => 'tree-ids.js',
         tree => \@tree,  
321  );  );
322    
323    $tree->output(
324            dir => './eurovoc',
325            html => 'hijerarhija.html',
326            template => './output_template/hijerarhija.tt',
327            js => 'tree-ids.js',
328    );
329    
330    
331  $log->info("closing index");  $log->info("closing index");
332  $index->close;  $index->close;
333    

Legend:
Removed from v.490  
changed lines
  Added in v.530

  ViewVC Help
Powered by ViewVC 1.1.26