/// <summary> /// Switches stuff use to alternate/user-edited data. <see cref="EditorPhonF"/> /// @note The data in the "PHONEMES" table changes as data is edited in /// 'EditorPhonF' so if that is canceled the table needs to revert. /// </summary> /// <param name="revert">true to revert to previous data</param> internal void AlternateData(bool revert = false) { if (!revert) { rb_alt.Checked = false; // force false to allow the radio-button to refire. _dt1.Rows.Clear(); _dt2.Rows.Clear(); _fxedata_alt.Clear(); FxeData.GenerateData(_ars_alt, _fxedata_alt); rb_alt.Checked = rb_alt.Visible = true; // fire rb_CheckChanged rb_def.Visible = true; // else default-button won't be visible if there's no typed-text. } else { object rb; if (rb_def.Checked) { rb = rb_def; } else if (rb_enh.Checked) { rb = rb_enh; } else { rb = rb_alt; } checkedchanged_Radio(rb, EventArgs.Empty); } }
/// <summary> /// This is the biggie. Generates and prints data after the /// SpeechRecognition stream of an audio-file finishes. /// </summary> /// <param name="ars_def"></param> /// <param name="ars_enh"></param> void OnSrStreamEnded(List <OrthographicResult> ars_def, List <OrthographicResult> ars_enh) { #if DEBUG logfile.Log(); logfile.Log("OnSrStreamEnded() ars_def.Count= " + ars_def.Count + " ars_enh.Count= " + ars_enh.Count); #endif _ars_def = ars_def; _ars_enh = ars_enh; if (!isConsole) { PrintResults(_ars_def, tb_def_words, tb_def_phons); if (tb_text.Text != String.Empty) { PrintResults(_ars_enh, tb_enh_words, tb_enh_phons); la_def_word_pct.Text = _sapi.RatioWords_def.ToString("P1"); la_enh_word_pct.Text = _sapi.RatioWords_enh.ToString("P1"); } else { la_def_word_pct.Text = _sapi.Confidence_def.ToString("P1"); } if (_sapi.Expected.Count != 0) { la_def_phon_pct.Text = _sapi.RatioPhons_def.ToString("P1"); la_enh_phon_pct.Text = _sapi.RatioPhons_enh.ToString("P1"); rb_def.Visible = rb_enh.Visible = true; } ColorPercents(tb_text.Text == String.Empty); bu_createfxe.Enabled = co_headtype.Enabled = true; } FxeData.GenerateData(_ars_def, _fxedata_def); FxeData.GenerateData(_ars_enh, _fxedata_enh); #if DEBUG logfile.Log(". _sapi.RatioPhons_def= " + _sapi.RatioPhons_def); logfile.Log(". _sapi.RatioPhons_enh= " + _sapi.RatioPhons_enh); #endif if (tb_text.Text == String.Empty || _sapi.RatioPhons_def > _sapi.RatioPhons_enh) { #if DEBUG logfile.Log(". select DEFault"); #endif if (!isConsole) { #if DEBUG logfile.Log(". . rb_def"); #endif rb_def.Checked = true; // fire rb_CheckChanged } else { _fxedata = _fxedata_def; } } else { #if DEBUG logfile.Log(". select ENHanced"); #endif if (!isConsole) { #if DEBUG logfile.Log(". . rb_enh"); #endif rb_enh.Checked = true; // fire rb_CheckChanged } else { _fxedata = _fxedata_enh; } } if (!isConsole) { bu_edit.Enabled = bu_save.Enabled = (_dt1 != null && _dt1.Rows.Count != 0); bu_load.Enabled = true; Cursor = Cursors.Default; } else { string pfe = _pfe.Substring(0, _pfe.Length - 3).ToLower() + FxeGeneratorF.EXT_FXE; FxeWriter.WriteFile(pfe, _headtype, _fxedata); Application.Exit(); } }