-
Notifications
You must be signed in to change notification settings - Fork 5.4k
multi_en: Fixed acronym normalization, swbd lexicon preparation, OOV … #2137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
827ddbf
multi_en: Fixed acronym normalization, swbd lexicon preparation, OOV …
xiaohui-zhang 508358f
removed the last GMM training stage which didn't bring improvements
xiaohui-zhang f3549f2
minor fix
xiaohui-zhang 2283631
minor fix
xiaohui-zhang dc18c1c
minor fix
xiaohui-zhang 7eec69d
fixes #2206
xiaohui-zhang 1d4959a
minor fixes
xiaohui-zhang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| --sample-frequency=8000 | ||
| --low-freq=20 | ||
| --high-freq=3700 | ||
| --allow-downsample=true | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/bin/bash | ||
|
|
||
| ########################################################################################### | ||
| # This script was copied from egs/hub4_english/s5/local/data_prep/prepare_1996_bn_data.sh | ||
| # The source commit was 191ae0a6e5db19d316c82a78c746bcd56cc2d7da | ||
| # Changes in lower level script/dir names were made | ||
| ########################################################################################### | ||
|
|
||
| #!/bin/bash | ||
| # Copyright (c) 2017, Johns Hopkins University (Jan "Yenda" Trmal<[email protected]>) | ||
| # 2017 Vimal Manohar | ||
| # License: Apache 2.0 | ||
|
|
||
| # This script prepares the 1996 English Broadcast News (HUB4) corpus. | ||
| # /export/corpora/LDC/LDC97S44 | ||
| # /export/corpora/LDC/LDC97T22 | ||
|
|
||
| # Begin configuration section. | ||
| # End configuration section | ||
| set -e -o pipefail | ||
| set -o nounset # Treat unset variables as an error | ||
|
|
||
| if [ $# -ne 3 ]; then | ||
| echo "Usage: $0 <text-source> <speech-source> <out-dir>" | ||
| echo " e.g.: $0 /export/corpora/LDC/LDC97T22/hub4_eng_train_trans /export/corpora/LDC/LDC97S44/data data/local/data/train_bn96" | ||
| exit 1 | ||
| fi | ||
|
|
||
| text_source_dir=$1 # /export/corpora/LDC/LDC97T22/hub4_eng_train_trans | ||
| speech_source_dir=$2 # /export/corpora/LDC/LDC97S44/data | ||
| out=$3 | ||
|
|
||
| mkdir -p $out; | ||
|
|
||
| ls $text_source_dir/*/*.txt > $out/text.list | ||
| ls $speech_source_dir/*.sph > $out/audio.list | ||
|
|
||
| if [ ! -s $out/text.list ] || [ ! -s $out/audio.list ]; then | ||
| echo "$0: Could not get text and audio files" | ||
| exit 1 | ||
| fi | ||
|
|
||
| local/hub4_96_parse_sgm.pl $out/text.list > \ | ||
| $out/transcripts.txt 2> $out/parse_sgml.log || exit 1 | ||
|
|
||
| if [ ! -s $out/transcripts.txt ]; then | ||
| echo "$0: Could not parse SGML files in $out/text.list" | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "$0: 1996 English Broadcast News training data (HUB4) prepared in $out" | ||
| exit 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,235 @@ | ||
| #!/usr/bin/env perl | ||
| ########################################################################################### | ||
| # This script was copied from egs/hub4_english/s5/local/data_prep/parse_sgm_1996_hub4_eng.pl | ||
| # The source commit was 9f61a1b0efa76f37fc29fa2dbeede6dc776a0203 | ||
| # No change was made | ||
| ########################################################################################### | ||
|
|
||
| #=============================================================================== | ||
| # Copyright (c) 2017 Johns Hopkins University (Author: Jan "Yenda" Trmal <[email protected]>) | ||
| # 2017 Vimal Manohar | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED | ||
| # WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, | ||
| # MERCHANTABLITY OR NON-INFRINGEMENT. | ||
| # See the Apache 2 License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| #=============================================================================== | ||
|
|
||
| use strict; | ||
| use warnings; | ||
| use utf8; | ||
|
|
||
| require HTML::Parser or die "This script needs HTML::Parser from CPAN"; | ||
| HTML::Parser->import(); | ||
|
|
||
| binmode(STDOUT, ":utf8"); | ||
|
|
||
| sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s }; | ||
|
|
||
| sub parse_sgml_tag { | ||
| my $tag = shift(@_); | ||
| my %ret; | ||
|
|
||
| if ($tag !~ /=/) { | ||
| return %ret; | ||
| } | ||
|
|
||
| $tag =~ s/<[a-zA-Z]+ //; | ||
| $tag =~ s/> *$//; | ||
| #print $tag . "\n"; | ||
|
|
||
| my @key_value_pairs = split / *,? +/, $tag; | ||
| for my $entry(@key_value_pairs) { | ||
| (my $key, my $value) = split '=', $entry, 2; | ||
| $ret{$key}=$value; | ||
| } | ||
| return %ret; | ||
| } | ||
|
|
||
| if (@ARGV != 1) { | ||
| print STDERR "$0: This script needs exactly one parameter (list of SGML files)\n"; | ||
| print STDERR " Usage: $0 <transripts>\n"; | ||
| print STDERR " where\n"; | ||
| print STDERR " <transcripts> is a file containing the official SGML format\n"; | ||
| print STDERR " transcripts. The files are parsed and the parsed representation\n"; | ||
| print STDERR " is dumped to STDOUT (one utterance + the additional data fields\n"; | ||
| print STDERR " per line (we dump all the fields, but not all fields are used\n"; | ||
| print STDERR " in the recipe).\n"; | ||
| die; | ||
| } | ||
| my $filelist=$ARGV[0]; | ||
|
|
||
| my $p = HTML::Parser->new(); | ||
|
|
||
| my @files=(); | ||
| open(F, '<', $filelist) or die "Could not open file $filelist: $?\n"; | ||
| while(<F>) { | ||
| chomp; | ||
| push @files, $_; | ||
| } | ||
|
|
||
| foreach my $file (@files) { | ||
| my $reporter=""; | ||
| my $start = -1; | ||
| my $end = -1; | ||
| my $segment_start = -1; | ||
| my $segment_end = -1; | ||
| my $segment_speaker; | ||
| my $segment_fidelity = "XXX"; | ||
| my $segment_mode = "XXX"; | ||
| my $section_start = -1; | ||
| my $section_end = -1; | ||
| my $filename = ""; | ||
| my $seq = 0; | ||
| my @text = (); | ||
| my $time; | ||
| my @tagqueue; | ||
|
|
||
| my $sgml_file = `basename $file`; | ||
| $sgml_file = trim $sgml_file; | ||
| $sgml_file =~ s/\.txt$//g; | ||
| $sgml_file =~ s/\.sgml$//g; | ||
| $sgml_file =~ s/_$//g; | ||
|
|
||
| open(my $f, '<:encoding(iso-8859-1)', $file) or die "Could not open file $file: $?\n"; | ||
|
|
||
| while(my $line = <$f>) { | ||
| chomp $line; | ||
| $line = trim $line; | ||
| $line = lc $line; | ||
| next unless $line; | ||
|
|
||
| if ($line =~ /<episode/) { | ||
| my %tags = parse_sgml_tag $line; | ||
| $filename = $tags{'filename'}; | ||
| $filename =~ s/"//g; | ||
| $filename =~ s/\.sph//g; | ||
|
|
||
| if ($sgml_file ne $filename) { | ||
| print STDERR "$0: WARNING: SGML filename does not match episode filename $filename in file $file\n"; | ||
| } | ||
| #print "BS: $line\n"; | ||
| push @tagqueue, ["episode", \%tags]; | ||
| ; | ||
| } elsif ($line =~ /<\/episode/) { | ||
| my $p = pop @tagqueue; | ||
| $line =~ s/<\/(.*)( +.*)?>/$1/g; | ||
| $line = trim $line; | ||
| die "Unaligned tags: '" . $p->[0] . "' vs '$line'" if $p->[0] ne $line; | ||
| #print "ES: $line\n"; | ||
| ; | ||
| } elsif ($line =~ /<section/) { | ||
| my %tags = parse_sgml_tag $line; | ||
|
|
||
| if ($tags{'s_time'}) { | ||
| $section_start = $tags{'s_time'}; | ||
| } else { | ||
| $section_start = $tags{'starttime'}; | ||
| } | ||
|
|
||
| if ($tags{'e_time'}) { | ||
| $section_end = $tags{'e_time'}; | ||
| } else { | ||
| $section_end = $tags{'endtime'}; | ||
| } | ||
|
|
||
| #print "BS: $line\n"; | ||
| push @tagqueue, ["section", \%tags]; | ||
| ; | ||
| } elsif ($line =~ /<\/section/) { | ||
| my $p = pop @tagqueue; | ||
| $line =~ s/<\/(.*)( +.*)?>/$1/g; | ||
| $line = trim $line; | ||
| die "Unaligned tags: '" . $p->[0] . "' vs '$line'" if $p->[0] ne $line; | ||
| #print "ES: $line\n"; | ||
| ; | ||
| } elsif ($line =~ /<segment/) { | ||
| #print "BT: $line\n"; | ||
| my %tags = parse_sgml_tag $line; | ||
| $segment_speaker = $tags{'speaker'}; | ||
| $segment_speaker =~ s/"//g; | ||
| $segment_start = $tags{'s_time'}; | ||
| $segment_end = $tags{'e_time'}; | ||
| $segment_fidelity = $tags{'fidelity'} if $tags{'fidelity'}; | ||
| $segment_mode = $tags{'mode'} if $tags{'mode'}; | ||
| $time = $segment_start; | ||
| push @tagqueue, ["segment", \%tags]; | ||
| ; | ||
| } elsif ($line =~ /<\/segment/) { | ||
| my $p = pop @tagqueue; | ||
| $line =~ s/<\/(.*)( +.*)?>/$1/g; | ||
| $line = trim $line; | ||
| die "Unaligned tags: '" . $p->[0] . "' vs '$line'" if $p->[0] ne $line; | ||
|
|
||
| #print join(" ", @text) . "\n" if @text > 0; | ||
| my $new_time = $segment_end; | ||
| if (@text > 0) { | ||
| print "$sgml_file $filename $segment_speaker $segment_fidelity $segment_mode $time $new_time "; | ||
| print join(" ", @text) . "\n"; | ||
| } | ||
| @text = (); | ||
| $time = 0; | ||
| $segment_speaker = "XXX"; | ||
| $segment_start = "XXX"; | ||
| $segment_end = "XXX"; | ||
| $segment_fidelity = "XXX"; | ||
| $segment_mode = "XXX"; | ||
| #print "ET: $line\n"; | ||
| ; | ||
| } elsif ($line =~ /<sync/) { | ||
| my %tags = parse_sgml_tag $line; | ||
| my $new_time = $tags{'time'}; | ||
| if (@text > 0) { | ||
| print "$sgml_file $filename $segment_speaker $segment_fidelity $segment_mode $time $new_time "; | ||
| print join(" ", @text) . "\n"; | ||
| } | ||
| @text = (); | ||
| $time = $new_time; | ||
| ; | ||
| } elsif ($line =~ /<\/sync/) { | ||
| #print $line; | ||
| ; | ||
| } elsif ($line =~ /<overlap/) { | ||
| #print $line; | ||
| ; | ||
| } elsif ($line =~ /<\/overlap/) { | ||
| #print $line; | ||
| ; | ||
| } elsif ($line =~ /<background/ || $line =~ /<comment/) { | ||
| # ignore line; | ||
| } elsif ($line =~ /<foreign/) { | ||
| $line = trim $line; | ||
| push @text, $line; | ||
| } elsif ($line =~ /<\/foreign/) { | ||
| $line = trim $line; | ||
| push @text, $line; | ||
| ; | ||
| } elsif ($line =~ /<unclear/) { | ||
| $line = trim $line; | ||
| push @text, $line; | ||
| } elsif ($line =~ /<\/unclear/) { | ||
| $line = trim $line; | ||
| push @text, $line; | ||
| ; | ||
| } elsif ($line =~ /<[^\/]/) { | ||
| parse_sgml_tag $line; | ||
| print STDERR "$0: INFO: Unknown tag $line in file $file\n"; | ||
| } elsif ($line =~ /<\//) { | ||
| ; | ||
| } else { | ||
| $line = trim $line; | ||
| push @text, $line if $line; | ||
| ; | ||
| } | ||
|
|
||
| } | ||
| close($f); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm pretty sure this comment doesn't belong here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also the results seems lightly worse than before. Is there an explanation for this? Is it the case that for other test sets it was better?
What exactly is better about this new setup than how it was before?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed some bugs of acronym normalization in swbd training data prep (previously these acronyms were wrongly normalized as OOVs), and I fixed the way we apply G2P to OOVs in training data, i.e. we won't apply G2P to words containing special characters. But these changes are too tiny to affect WERs. The major change which may affect WER is we now have 72h more training data (hub4 97). Since there are mismatch between hub4's bn style and eval2000's style, there could be some degradation at GMM level (actually looking tri5a.si and tri5b.si it's slightly better than before). I think this could be compensated at chain model level. BTW I intentionally made that comment there...