FunASR/egs/alimeeting/sa_asr/local/text_normalize.pl
yhliang e8528b8f62
Dev lyh (#645)
* update

* update

* fix bug

* fix bug
2023-06-16 20:16:47 +08:00

39 lines
1.3 KiB
Perl
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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 =~ //) {$tmp =~ s::A:g;}
if ($tmp =~ //) {$tmp =~ s::A:g;}
if ($tmp =~ //) {$tmp =~ s::B:g;}
if ($tmp =~ //) {$tmp =~ s::C:g;}
if ($tmp =~ //) {$tmp =~ s::K:g;}
if ($tmp =~ //) {$tmp =~ s::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";
}