Commit 75c6d183 authored by Mickael Rouvier's avatar Mickael Rouvier
Browse files

new option for adaptation state

parent f6908357
......@@ -67,6 +67,7 @@ enum {
PROP_0,
PROP_SILENT,
PROP_MODEL,
PROP_STATE_IVECTOR,
PROP_FST,
PROP_WORD_SYMS,
PROP_DO_ENDPOINTING,
......@@ -80,6 +81,7 @@ enum {
};
#define DEFAULT_MODEL "final.mdl"
#define DEFAULT_STATE_IVECTOR ""
#define DEFAULT_FST "HCLG.fst"
#define DEFAULT_WORD_SYMS "words.txt"
#define DEFAULT_LMWT_SCALE 1.0
......@@ -164,6 +166,14 @@ static void gst_kaldinnet2onlinedecoder_class_init(
"Filename of the acoustic model",
DEFAULT_MODEL,
(GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property(
gobject_class,
PROP_STATE_IVECTOR,
g_param_spec_string("state_ivector", "State ivector",
"Filename of the state ivector",
DEFAULT_MODEL,
(GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property(
gobject_class, PROP_FST,
g_param_spec_string("fst", "Decoding FST", "Filename of the HCLG FST",
......@@ -299,6 +309,7 @@ static void gst_kaldinnet2onlinedecoder_init(
filter->silent = FALSE;
filter->model_rspecifier = g_strdup(DEFAULT_MODEL);
filter->state_ivector_rspecifier = g_strdup(DEFAULT_STATE_IVECTOR);
filter->fst_rspecifier = g_strdup(DEFAULT_FST);
filter->word_syms_filename = g_strdup(DEFAULT_WORD_SYMS);
......@@ -421,6 +432,10 @@ static void gst_kaldinnet2onlinedecoder_set_property(GObject * object,
g_free(filter->model_rspecifier);
filter->model_rspecifier = g_value_dup_string(value);
break;
case PROP_STATE_IVECTOR:
g_free(filter->state_ivector_rspecifier);
filter->state_ivector_rspecifier = g_value_dup_string(value);
break;
case PROP_FST:
g_free(filter->fst_rspecifier);
filter->fst_rspecifier = g_value_dup_string(value);
......@@ -457,6 +472,7 @@ static void gst_kaldinnet2onlinedecoder_set_property(GObject * object,
std::istringstream str(adaptation_state_string);
try {
filter->adaptation_state->Read(str, false);
GST_WARNING_OBJECT(filter, "DEBUG MICKA : Le fichir a bien ete lu");
} catch (std::runtime_error& e) {
GST_WARNING_OBJECT(filter, "Failed to read adaptation state from given string, resetting instead");
delete filter->adaptation_state;
......@@ -537,6 +553,9 @@ static void gst_kaldinnet2onlinedecoder_get_property(GObject * object,
case PROP_MODEL:
g_value_set_string(value, filter->model_rspecifier);
break;
case PROP_STATE_IVECTOR:
g_value_set_string(value, filter->state_ivector_rspecifier);
break;
case PROP_FST:
g_value_set_string(value, filter->fst_rspecifier);
break;
......@@ -1151,6 +1170,7 @@ static void gst_kaldinnet2onlinedecoder_finalize(GObject * object) {
Gstkaldinnet2onlinedecoder *filter = GST_KALDINNET2ONLINEDECODER(object);
g_free(filter->model_rspecifier);
g_free(filter->state_ivector_rspecifier);
g_free(filter->fst_rspecifier);
g_free(filter->word_syms_filename);
delete filter->endpoint_config;
......
......@@ -71,6 +71,7 @@ struct _Gstkaldinnet2onlinedecoder {
GstBufferSource *audio_source;
gchar* model_rspecifier;
gchar* state_ivector_rspecifier;
gchar* fst_rspecifier;
gchar* word_syms_filename;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment