Skip to content

fix utils/lang/extend_lang.sh to add nonterm symbols in align_lexicon.txt #3556

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 9 commits into from
Aug 30, 2019
7 changes: 7 additions & 0 deletions egs/wsj/s5/utils/lang/extend_lang.sh
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ perl -ape 's/(\S+\s+)\S+\s+(.+)/$1$2/;' <$tmpdir/lexiconp.txt >$tmpdir/align_lex
cat $tmpdir/align_lexicon.txt | \
perl -ane '@A = split; print $A[0], " ", join(" ", @A), "\n";' | sort | uniq > $dir/phones/align_lexicon.txt

if [ -f $dir/phones/nonterminals.txt ]; then
for w in "#nonterm_begin" "#nonterm_end" $(cat $dir/phones/nonterminals.txt); do
echo $w $w # These are words without pronunciations, so leave those prons
# empty.
done >> $dir/phones/align_lexicon.txt
fi

# create phones/align_lexicon.int from phones/align_lexicon.txt
cat $dir/phones/align_lexicon.txt | utils/sym2int.pl -f 3- $dir/phones.txt | \
utils/sym2int.pl -f 1-2 $dir/words.txt > $dir/phones/align_lexicon.int
Expand Down