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; |
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 |
|
return lc($string); |
67 |
|
} |
68 |
|
|
69 |
# create WebPAC object |
# create WebPAC object |
70 |
# |
# |
71 |
my $webpac = new WebPAC( |
my $webpac = new WebPAC( |
170 |
#path => $f, |
#path => $f, |
171 |
path => $webpac->mfn, |
path => $webpac->mfn, |
172 |
headline => $h, |
headline => $h, |
173 |
words => $words, |
words => unac($words), |
174 |
); |
); |
175 |
} |
} |
176 |
|
|
182 |
|
|
183 |
foreach my $h (@{$ds->{'index'}}) { |
foreach my $h (@{$ds->{'index'}}) { |
184 |
$thes->{$ds->{'tag'}}->insert( |
$thes->{$ds->{'tag'}}->insert( |
185 |
headline => $h, |
sort_by => unac_2($h), |
186 |
mfn => $webpac->mfn, |
mfn => $webpac->mfn, |
187 |
|
headline => $h, |
188 |
); |
); |
189 |
} |
} |
190 |
} |
} |