]> mj.ucw.cz Git - libucw.git/blob - charset/misc/mksig
Rewrote to use pread/pwrite() and to avoid messing up with internals
[libucw.git] / charset / misc / mksig
1 #!/usr/bin/perl
2 #
3 #  Create Word Signature Table
4 #  (c) 1997 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5 #
6
7 open (U, "misc/u-upper") || die "No uppercase map";
8 while (<U>) {
9     chomp;
10     /^(....)\t0x(....)$/ || die "Syntax error";
11     $upper{$1} = $2;
12 }
13 close U;
14
15 open (U, "misc/u-unacc") || die "No unaccent map";
16 while (<U>) {
17     chomp;
18     /^(....)\t0x(....)$/ || die "Syntax error";
19     $unacc{$1} = $2;
20 }
21 close U;
22
23 open (U, "set/sig") || die "No signature set";
24 while (<U>) {
25     chomp;
26     /^(..)\t(....)\t/ || next;
27     $sigset{$2} = $1;
28 }
29 close U;
30
31 open (U, "misc/u-cat") || die "No category map";
32 while (<U>) {
33     chomp;
34     /^(....)\t/ || die "Syntax error";
35     $from = $1;
36     /_C_(UPPER|LOWER)/ || next;
37     $to = (defined $upper{$from}) ? $upper{$from} : $from;
38     $to = (defined $unacc{$to}) ? $unacc{$to} : $to;
39     if (defined $sigset{$to}) { print "$from\t0x$sigset{$to}\n"; }
40 }