-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patheng.plx
executable file
·51 lines (46 loc) · 1.05 KB
/
eng.plx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/perl
use warnings; use strict; use open 'utf8'; use utf8; use feature 'unicode_strings';
binmode STDIN, ':utf8'; binmode STDOUT, ':utf8'; binmode STDERR, ':utf8';
use lib "$ENV{'ORACC_BUILDS'}/lib";
# Eng table
#
# Create a simple table giving eng-less forms for values which have eng in them.
#
# E.g., ŋa₂ ga₂
#
my @o = `cat 00lib/ogsl.asl`; chomp @o;
my @v = ();
open(C,'>00etc/eng.tab') || die;
foreach (@o) {
if (/^\@end\s+sign/) {
compute_engs();
@v = ();
} elsif (/^\@v\s+(\S+)$/) {
push @v, $1;
}
}
close(C);
#################################################################################
sub compute_engs {
my %nonum = ();
foreach my $v (@v) {
my $vn = $v; $vn =~ tr/₀-₉ₓ//d;
$nonum{$vn} = $v unless $nonum{$vn};
}
foreach my $v (keys %nonum) {
if ($v =~ /ŋ/) {
my $vv = $v;
$vv =~ s/ŋ/g/g;
if ($nonum{$vv}) {
print C "$nonum{$v}\t$nonum{$vv}\n";
} else {
$vv = $v;
$vv =~ s/ŋ/m/g;
if ($nonum{$vv}) {
print C "$nonum{$v}\t$nonum{$vv}\n";
}
}
}
}
}
1;