]> git.donarmstrong.com Git - deb_pkgs/scowl.git/blob - src/proc-alt12dicts
* fix triple letter misspellings
[deb_pkgs/scowl.git] / src / proc-alt12dicts
1 #!/usr/bin/perl -w
2
3 chdir "r/alt12dicts";
4
5 open IN, "abbr.txt";
6 open OUT, ">abbr.lst";
7 while (<IN>) 
8 {
9     next if /~/;
10     y/:\r//d;
11     print OUT;
12 }
13 close OUT;
14 close IN;
15
16 open IN, "variant.txt";
17 open OYES  , ">variant-yes.lst";
18 open OMAYBE, ">variant-maybe.lst";
19 open BYES  , ">nonamer-yes.lst";
20 open BMAYBE, ">nonamer-maybe.lst";
21 while (<IN>) {
22     s/\r?\n$// or die;
23     ($w, $f, $s) = /^(.+):?\t(.)([!?]?)$/ or die "Bad Line: $_";
24     next unless $w =~ /^[A-Za-z\']+$/;
25     $already_variant{$w} = 1;
26     if ($s eq '!' || $s eq '') {
27         print OYES $w, "\n" if $f eq '#';
28         print BYES $w, "\n" if $f eq '&';
29     } else {
30         print OMAYBE $w, "\n" if $f eq '#';
31         print BMAYBE $w, "\n" if $f eq '&';
32     }
33 }
34
35 close BMAYBE;
36 close BYES;
37 close OMAYBE;
38 close OYES;
39 close IN;
40
41 open IN, "2of12full.txt";
42 open O02, ">02of12.lst";
43 open O05, ">05of12.lst";
44 open O11, ">11of12.lst";
45 open U, ">4of12upper.lst";
46 open ONA, ">not-abbr.lst";
47 open V, ">variant-also.lst";
48 open NV, ">not-variant.lst";
49
50 while (<IN>)
51 {
52     s/\r?\n$// or die;
53     ($total, $not_variant, $variant, $non_american, $word, $abrv_mark) 
54         = /^(..): (..) (..)\# (..)\&   (.+?)([:.]?)$/ or die "Bad Line:$_";
55     $_ = $word;
56     $not_variant  = 0 if $not_variant  eq ' -';
57     $variant      = 0 if $variant      eq ' -';
58     $non_american = 0 if $non_american eq ' -';
59     next unless /^[A-Za-z\']+$/;
60     $_ .= "\n";
61     my $not_abrv   = ($abrv_mark eq '' && $total >= 5);
62     my $is_variant = ($variant >= $non_american 
63                       && ($variant + $non_american) > $not_variant
64                       && !$already_variant{$word});
65     print ONA if $not_abrv;
66     print V   if $is_variant;
67     print NV  unless $is_variant || $already_variant{$word};
68     if ($total >= 11) {
69         print O11;
70     } elsif ($total >= 5) {
71         print O05;
72     } elsif ($total >= 4 && /^[A-Z]+/ && $abrv_mark eq '') {
73         print U;
74     } elsif ($total >= 2) {
75         print O02;
76     } else {
77         die "This should not happen: $total $_\n";
78     }
79 }
80
81 close NV;
82 close V;
83 close ONA;
84 close U;
85 close O11;
86 close O05;
87 close O02;
88 close IN;
89
90
91
92
93
94
95