jmwang66
2023-05-09 8dab6d184a034ca86eafa644ea0d2100aadfe27d
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
#!/usr/bin/env perl
use warnings; #sed replacement for -w perl parameter
# Copyright Chao Weng 
 
# normalizations for hkust trascript
# see the docs/trans-guidelines.pdf for details
 
while (<STDIN>) {
  @A = split(" ", $_);
  print "$A[0] ";
  for ($n = 1; $n < @A; $n++) { 
    $tmp = $A[$n];
    if ($tmp =~ /<sil>/) {$tmp =~ s:<sil>::g;}
    if ($tmp =~ /<%>/) {$tmp =~ s:<%>::g;}
    if ($tmp =~ /<->/) {$tmp =~ s:<->::g;}
    if ($tmp =~ /<\$>/) {$tmp =~ s:<\$>::g;}
    if ($tmp =~ /<#>/) {$tmp =~ s:<#>::g;}
    if ($tmp =~ /<_>/) {$tmp =~ s:<_>::g;}
    if ($tmp =~ /<space>/) {$tmp =~ s:<space>::g;}
    if ($tmp =~ /`/) {$tmp =~ s:`::g;}
    if ($tmp =~ /&/) {$tmp =~ s:&::g;}
    if ($tmp =~ /,/) {$tmp =~ s:,::g;}
    if ($tmp =~ /[a-zA-Z]/) {$tmp=uc($tmp);} 
    if ($tmp =~ /A/) {$tmp =~ s:A:A:g;}
    if ($tmp =~ /a/) {$tmp =~ s:a:A:g;}
    if ($tmp =~ /b/) {$tmp =~ s:b:B:g;}
    if ($tmp =~ /c/) {$tmp =~ s:c:C:g;}
    if ($tmp =~ /k/) {$tmp =~ s:k:K:g;}
    if ($tmp =~ /t/) {$tmp =~ s:t:T:g;}
    if ($tmp =~ /,/) {$tmp =~ s:,::g;}
    if ($tmp =~ /丶/) {$tmp =~ s:丶::g;}
    if ($tmp =~ /。/) {$tmp =~ s:。::g;}
    if ($tmp =~ /、/) {$tmp =~ s:、::g;}
    if ($tmp =~ /?/) {$tmp =~ s:?::g;}
    print "$tmp "; 
  }
  print "\n"; 
}