def write_fst_with_silence(lexicon, sil_prob, sil_phone, sil_disambig, nonterminals=None, left_context_phones=None):
    'Writes the text format of L.fst to the standard output.  This version is for\n       when --sil-prob != 0.0, meaning there is optional silence\n     \'lexicon\' is a list of 3-tuples (word, pron-prob, prons)\n         as returned by read_lexiconp().\n     \'sil_prob\', which is expected to be strictly between 0.. and 1.0, is the\n         probability of silence\n     \'sil_phone\' is the silence phone, e.g. "SIL".\n     \'sil_disambig\' is either None, or the silence disambiguation symbol, e.g. "#5".\n     \'nonterminals\', which relates to grammar decoding (see kaldi-asr.org/doc/grammar.html),\n        is either None, or the user-defined nonterminal symbols as a list of\n        strings, e.g. [\'#nonterm:contact_list\', ... ].\n     \'left_context_phones\', which also relates to grammar decoding, and must be\n        supplied if \'nonterminals\' is supplied is either None or a list of\n        phones that may appear as left-context, e.g. [\'a\', \'ah\', ... \'#nonterm_bos\'].\n    '
    assert ((sil_prob > 0.0) and (sil_prob < 1.0))
    sil_cost = (- math.log(sil_prob))
    no_sil_cost = (- math.log((1.0 - sil_prob)))
    start_state = 0
    loop_state = 1
    sil_state = 2
    next_state = 3
    print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=start_state, dest=loop_state, phone='<eps>', word='<eps>', cost=no_sil_cost))
    print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=start_state, dest=sil_state, phone='<eps>', word='<eps>', cost=sil_cost))
    if (sil_disambig is None):
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_state, dest=loop_state, phone=sil_phone, word='<eps>', cost=0.0))
    else:
        sil_disambig_state = next_state
        next_state += 1
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_state, dest=sil_disambig_state, phone=sil_phone, word='<eps>', cost=0.0))
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_disambig_state, dest=loop_state, phone=sil_disambig, word='<eps>', cost=0.0))
    for (word, pronprob, pron) in lexicon:
        pron_cost = (- math.log(pronprob))
        cur_state = loop_state
        for i in range((len(pron) - 1)):
            print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=next_state, phone=pron[i], word=(word if (i == 0) else '<eps>'), cost=(pron_cost if (i == 0) else 0.0)))
            cur_state = next_state
            next_state += 1
        i = (len(pron) - 1)
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=loop_state, phone=(pron[i] if (i >= 0) else '<eps>'), word=(word if (i <= 0) else '<eps>'), cost=(no_sil_cost + (pron_cost if (i <= 0) else 0.0))))
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=sil_state, phone=(pron[i] if (i >= 0) else '<eps>'), word=(word if (i <= 0) else '<eps>'), cost=(sil_cost + (pron_cost if (i <= 0) else 0.0))))
    if (nonterminals is not None):
        next_state = write_nonterminal_arcs(start_state, loop_state, next_state, nonterminals, left_context_phones)
    print('{state}\t{final_cost}'.format(state=loop_state, final_cost=0.0))
Writes the text format of L.fst to the standard output.  This version is for
  when --sil-prob != 0.0, meaning there is optional silence
'lexicon' is a list of 3-tuples (word, pron-prob, prons)
    as returned by read_lexiconp().
'sil_prob', which is expected to be strictly between 0.. and 1.0, is the
    probability of silence
'sil_phone' is the silence phone, e.g. "SIL".
'sil_disambig' is either None, or the silence disambiguation symbol, e.g. "#5".
'nonterminals', which relates to grammar decoding (see kaldi-asr.org/doc/grammar.html),
   is either None, or the user-defined nonterminal symbols as a list of
   strings, e.g. ['#nonterm:contact_list', ... ].
'left_context_phones', which also relates to grammar decoding, and must be
   supplied if 'nonterminals' is supplied is either None or a list of
   phones that may appear as left-context, e.g. ['a', 'ah', ... '#nonterm_bos'].
def write_fst_with_silence(lexicon, sil_prob, sil_phone, sil_disambig, nonterminals=None, left_context_phones=None):
    'Writes the text format of L.fst to the standard output.  This version is for\n       when --sil-prob != 0.0, meaning there is optional silence\n     \'lexicon\' is a list of 3-tuples (word, pron-prob, prons)\n         as returned by read_lexiconp().\n     \'sil_prob\', which is expected to be strictly between 0.. and 1.0, is the\n         probability of silence\n     \'sil_phone\' is the silence phone, e.g. "SIL".\n     \'sil_disambig\' is either None, or the silence disambiguation symbol, e.g. "#5".\n     \'nonterminals\', which relates to grammar decoding (see kaldi-asr.org/doc/grammar.html),\n        is either None, or the user-defined nonterminal symbols as a list of\n        strings, e.g. [\'#nonterm:contact_list\', ... ].\n     \'left_context_phones\', which also relates to grammar decoding, and must be\n        supplied if \'nonterminals\' is supplied is either None or a list of\n        phones that may appear as left-context, e.g. [\'a\', \'ah\', ... \'#nonterm_bos\'].\n    '
    assert ((sil_prob > 0.0) and (sil_prob < 1.0))
    sil_cost = (- math.log(sil_prob))
    no_sil_cost = (- math.log((1.0 - sil_prob)))
    start_state = 0
    loop_state = 1
    sil_state = 2
    next_state = 3
    print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=start_state, dest=loop_state, phone='<eps>', word='<eps>', cost=no_sil_cost))
    print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=start_state, dest=sil_state, phone='<eps>', word='<eps>', cost=sil_cost))
    if (sil_disambig is None):
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_state, dest=loop_state, phone=sil_phone, word='<eps>', cost=0.0))
    else:
        sil_disambig_state = next_state
        next_state += 1
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_state, dest=sil_disambig_state, phone=sil_phone, word='<eps>', cost=0.0))
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=sil_disambig_state, dest=loop_state, phone=sil_disambig, word='<eps>', cost=0.0))
    for (word, pronprob, pron) in lexicon:
        pron_cost = (- math.log(pronprob))
        cur_state = loop_state
        for i in range((len(pron) - 1)):
            print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=next_state, phone=pron[i], word=(word if (i == 0) else '<eps>'), cost=(pron_cost if (i == 0) else 0.0)))
            cur_state = next_state
            next_state += 1
        i = (len(pron) - 1)
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=loop_state, phone=(pron[i] if (i >= 0) else '<eps>'), word=(word if (i <= 0) else '<eps>'), cost=(no_sil_cost + (pron_cost if (i <= 0) else 0.0))))
        print('{src}\t{dest}\t{phone}\t{word}\t{cost}'.format(src=cur_state, dest=sil_state, phone=(pron[i] if (i >= 0) else '<eps>'), word=(word if (i <= 0) else '<eps>'), cost=(sil_cost + (pron_cost if (i <= 0) else 0.0))))
    if (nonterminals is not None):
        next_state = write_nonterminal_arcs(start_state, loop_state, next_state, nonterminals, left_context_phones)
    print('{state}\t{final_cost}'.format(state=loop_state, final_cost=0.0))