def main():
    args = get_args()
    lexicon = read_lexiconp(args.lexiconp)
    if (args.nonterminals is None):
        (nonterminals, left_context_phones) = (None, None)
    else:
        if (args.left_context_phones is None):
            print('{0}: if --nonterminals is specified, --left-context-phones must also be specified'.format(sys.argv[0]))
            sys.exit(1)
        nonterminals = read_nonterminals(args.nonterminals)
        left_context_phones = read_left_context_phones(args.left_context_phones)
    if (args.sil_prob == 0.0):
        write_fst_no_silence(lexicon, nonterminals=nonterminals, left_context_phones=left_context_phones)
    else:
        if ((args.sil_prob < 0.0) or (args.sil_prob >= 1.0)):
            print('{0}: invalid value specified --sil-prob={1}'.format(sys.argv[0], args.sil_prob), file=sys.stderr)
            sys.exit(1)
        if (not is_token(args.sil_phone)):
            print("{0}: you specified --sil-prob={1} but --sil-phone is set to '{2}'".format(sys.argv[0], args.sil_prob, args.sil_phone), file=sys.stderr)
            sys.exit(1)
        if ((args.sil_disambig is not None) and (not is_token(args.sil_disambig))):
            print("{0}: invalid value --sil-disambig='{1}' was specified.".format(sys.argv[0], args.sil_disambig), file=sys.stderr)
            sys.exit(1)
        write_fst_with_silence(lexicon, args.sil_prob, args.sil_phone, args.sil_disambig, nonterminals=nonterminals, left_context_phones=left_context_phones)
def main():
    args = get_args()
    lexicon = read_lexiconp(args.lexiconp)
    if (args.nonterminals is None):
        (nonterminals, left_context_phones) = (None, None)
    else:
        if (args.left_context_phones is None):
            print('{0}: if --nonterminals is specified, --left-context-phones must also be specified'.format(sys.argv[0]))
            sys.exit(1)
        nonterminals = read_nonterminals(args.nonterminals)
        left_context_phones = read_left_context_phones(args.left_context_phones)
    if (args.sil_prob == 0.0):
        write_fst_no_silence(lexicon, nonterminals=nonterminals, left_context_phones=left_context_phones)
    else:
        if ((args.sil_prob < 0.0) or (args.sil_prob >= 1.0)):
            print('{0}: invalid value specified --sil-prob={1}'.format(sys.argv[0], args.sil_prob), file=sys.stderr)
            sys.exit(1)
        if (not is_token(args.sil_phone)):
            print("{0}: you specified --sil-prob={1} but --sil-phone is set to '{2}'".format(sys.argv[0], args.sil_prob, args.sil_phone), file=sys.stderr)
            sys.exit(1)
        if ((args.sil_disambig is not None) and (not is_token(args.sil_disambig))):
            print("{0}: invalid value --sil-disambig='{1}' was specified.".format(sys.argv[0], args.sil_disambig), file=sys.stderr)
            sys.exit(1)
        write_fst_with_silence(lexicon, args.sil_prob, args.sil_phone, args.sil_disambig, nonterminals=nonterminals, left_context_phones=left_context_phones)