/[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 530 by dpavlin, Tue Oct 19 17:43:52 2004 UTC revision 549 by dpavlin, Tue Oct 26 20:53:03 2004 UTC
# Line 11  use locale; Line 11  use locale;
11  use YAML;  use YAML;
12  use Carp;  use Carp;
13  use Getopt::Long;  use Getopt::Long;
14    use Text::Unaccent 1.02;
15    
16  use lib './lib';  use lib './lib';
17  use WebPAC;  use WebPAC;
# Line 46  my $filter = { Line 47  my $filter = {
47          },          },
48  };  };
49    
50    ## remove accented characters
51    #
52    sub unac {
53            my $string = shift || return;
54            $string = unac_string($code_page,$string);
55            $string =~ tr/ðÐ/dD/;
56            return $string;
57    }
58    sub unac_2 {
59            my $string = shift || return;
60            if (length($string) > 2) {
61                    my $pr = substr($string,0,2);
62                    $string = unac_string($code_page,substr($string,2));
63                    $string =~ tr/ðÐ/dD/;
64                    $string = $pr . $string;
65            }
66            $string =~ s/&(\w)(acute|cedil|circ|grave|ring|slash|tilde|uml);/$1/gi;
67            $string =~ s/ð/d/g;
68            $string =~ s/&E[tT][hH];/D/g;
69            $string =~ s/&(\w\w)lig;/$1/gi;
70            return lc($string);
71    }
72    
73  # create WebPAC object  # create WebPAC object
74  #  #
75  my $webpac = new WebPAC(  my $webpac = new WebPAC(
# Line 150  while (my $rec = $webpac->fetch_rec) { Line 174  while (my $rec = $webpac->fetch_rec) {
174                          #path => $f,                          #path => $f,
175                          path => $webpac->mfn,                          path => $webpac->mfn,
176                          headline => $h,                          headline => $h,
177                          words => $words,                          words => unac($words),
178                  );                  );
179          }          }
180    
# Line 162  while (my $rec = $webpac->fetch_rec) { Line 186  while (my $rec = $webpac->fetch_rec) {
186    
187                  foreach my $h (@{$ds->{'index'}}) {                  foreach my $h (@{$ds->{'index'}}) {
188                          $thes->{$ds->{'tag'}}->insert(                          $thes->{$ds->{'tag'}}->insert(
189                                  headline => $h,                                  sort_by => unac_2($h),
190                                  mfn => $webpac->mfn,                                  mfn => $webpac->mfn,
191                                    headline => $h,
192                          );                          );
193                  }                  }
194          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.26