mirror of
https://github.com/modelscope/FunASR
synced 2025-09-15 14:48:36 +08:00
39 lines
1.3 KiB
Perl
Executable File
39 lines
1.3 KiB
Perl
Executable File
#!/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";
|
||
}
|