Пример #1
0
state_t *next_utt_states(uint32 *n_state,
			 lexicon_t *lex,
			 model_inventory_t *inv,
			 model_def_t *mdef,
			 char *trans,
			 int32 sil_del,
			 char* silence_str
			 )
{
    char **word;
    uint32 n_word;
    uint32 n_phone;
    char *btw_mark;
    acmod_set_t *acmod_set;
    acmod_id_t *phone;
    acmod_id_t optSil;

    state_t *state_seq;

    word  = mk_wordlist(trans, &n_word);

    phone = mk_phone_list(&btw_mark, &n_phone, word, n_word, lex);
    if (phone == NULL) {
	E_WARN("Unable to produce CI phones for utt\n");
	ckd_free(word);
	return NULL;
    }

    acmod_set = inv->acmod_set;

#ifdef NEXT_UTT_STATES_VERBOSE
    print_phone_list(phone, n_phone, btw_mark, acmod_set);
#endif

    cvt2triphone(acmod_set, phone, btw_mark, n_phone);

#ifdef NEXT_UTT_STATES_VERBOSE
    print_phone_list(phone, n_phone, btw_mark, acmod_set);
#endif
    
    optSil= acmod_set_name2id(acmod_set, silence_str);
/*
 * Debug?
 *   E_INFO("Silence id %d\n",optSil);
 */
    state_seq = state_seq_make(n_state, phone, n_phone, inv, mdef,sil_del,(acmod_id_t)optSil);

#ifdef NEXT_UTT_STATES_VERBOSE
    state_seq_print(state_seq, *n_state, mdef);
#endif

    ckd_free(phone);
    ckd_free(btw_mark);
    ckd_free(word);

    return state_seq;
}
Пример #2
0
state_t *next_utt_states(uint32 *n_state,
                         lexicon_t *lex,
                         model_inventory_t *inv,
                         model_def_t *mdef,
                         char *trans
                        )
{
    char **word;
    char *utterance;
    uint32 n_word;
    uint32 n_phone;
    char *btw_mark;
    acmod_set_t *acmod_set;
    acmod_id_t *phone;

    state_t *state_seq;

    utterance = ckd_salloc(trans);
    n_word = str2words(utterance, NULL, 0);
    word = ckd_calloc(n_word, sizeof(char*));
    str2words(utterance, word, n_word);

    phone = mk_phone_list(&btw_mark, &n_phone, word, n_word, lex);

    if (phone == NULL) {
        E_WARN("Unable to produce phonetic transcription for the utterance '%s'\n", trans);
        ckd_free(word);
        return NULL;
    }

    acmod_set = inv->acmod_set;

#ifdef NEXT_UTT_STATES_VERBOSE
    print_phone_list(phone, n_phone, btw_mark, acmod_set);
#endif

    cvt2triphone(acmod_set, phone, btw_mark, n_phone);

#ifdef NEXT_UTT_STATES_VERBOSE
    print_phone_list(phone, n_phone, btw_mark, acmod_set);
#endif

    state_seq = state_seq_make(n_state, phone, n_phone, inv, mdef);

#ifdef NEXT_UTT_STATES_VERBOSE
    state_seq_print(state_seq, *n_state, mdef);
#endif

    ckd_free(phone);
    ckd_free(btw_mark);
    ckd_free(word);
    ckd_free(utterance);

    return state_seq;
}