Skip to content

Commit

Permalink
[scripts] Fix initial prob of silence when lexicon has silprobs. Thx:@…
Browse files Browse the repository at this point in the history
  • Loading branch information
danpovey authored Nov 7, 2018
1 parent cc745dd commit ec7e592
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions egs/wsj/s5/utils/lang/make_lexicon_fst_silprob.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,8 @@ def write_fst(lexicon, silprobs, sil_phone, sil_disambig,
phones that may appear as left-context, e.g. ['a', 'ah', ... '#nonterm_bos'].
"""
silbeginprob, silendcorrection, nonsilendcorrection, siloverallprob = silprobs
sil_cost = -math.log(silbeginprob)
no_sil_cost = -math.log(1.0 - silbeginprob);
initial_sil_cost = -math.log(silbeginprob)
initial_non_sil_cost = -math.log(1.0 - silbeginprob);
sil_end_correction_cost = -math.log(silendcorrection)
non_sil_end_correction_cost = -math.log(nonsilendcorrection);
start_state = 0
Expand All @@ -296,10 +296,10 @@ def write_fst(lexicon, silprobs, sil_phone, sil_disambig,
# avoids having to introduce extra arcs).
print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(
src=start_state, dest=non_sil_state,
phone=sil_phone, word='<eps>', cost=no_sil_cost))
phone=sil_disambig, word='<eps>', cost=initial_non_sil_cost))
print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(
src=start_state, dest=sil_state,
phone=sil_disambig, word='<eps>', cost=sil_cost))
phone=sil_phone, word='<eps>', cost=initial_sil_cost))

for (word, pronprob, wordsilprob, silwordcorrection, nonsilwordcorrection, pron) in lexicon:
pron_cost = -math.log(pronprob)
Expand Down

0 comments on commit ec7e592

Please sign in to comment.