static void menu_cb_soundScaling (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Sound scaling", nullptr) OPTIONMENU_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my default_sound_scalingStrategy ()) LABEL (U"", U"For \"fixed height\":"); POSITIVE (U"Height", my default_sound_scaling_height ()) LABEL (U"", U"For \"fixed range\":"); REAL (U"Minimum", my default_sound_scaling_minimum ()) REAL (U"Maximum", my default_sound_scaling_maximum ()) EDITOR_OK SET_ENUM (U"Scaling strategy", kTimeSoundEditor_scalingStrategy, my p_sound_scalingStrategy) SET_REAL (U"Height", my p_sound_scaling_height) SET_REAL (U"Minimum", my p_sound_scaling_minimum) SET_REAL (U"Maximum", my p_sound_scaling_maximum) EDITOR_DO my pref_sound_scalingStrategy () = my p_sound_scalingStrategy = GET_ENUM (kTimeSoundEditor_scalingStrategy, U"Scaling strategy"); my pref_sound_scaling_height () = my p_sound_scaling_height = GET_REAL (U"Height"); my pref_sound_scaling_minimum () = my p_sound_scaling_minimum = GET_REAL (U"Minimum"); my pref_sound_scaling_maximum () = my p_sound_scaling_maximum = GET_REAL (U"Maximum"); FunctionEditor_redraw (me); EDITOR_END }
static void menu_cb_ExtractSelectedSound_windowed (TimeSoundEditor me, EDITOR_ARGS_FORM) { EDITOR_FORM (U"Extract selected sound (windowed)", nullptr) WORD (U"Name", U"slice") OPTIONMENU_ENUM (U"Window shape", kSound_windowShape, my default_extract_windowShape ()) POSITIVE (U"Relative width", my default_extract_relativeWidth ()) BOOLEAN (U"Preserve times", my default_extract_preserveTimes ()) EDITOR_OK SET_ENUM (U"Window shape", kSound_windowShape, my pref_extract_windowShape ()) SET_REAL (U"Relative width", my pref_extract_relativeWidth ()) SET_INTEGER (U"Preserve times", my pref_extract_preserveTimes ()) EDITOR_DO Sound sound = my d_sound.data; Melder_assert (sound); my pref_extract_windowShape () = GET_ENUM (kSound_windowShape, U"Window shape"); my pref_extract_relativeWidth () = GET_REAL (U"Relative width"); my pref_extract_preserveTimes () = GET_INTEGER (U"Preserve times"); autoSound extract = Sound_extractPart (sound, my d_startSelection, my d_endSelection, my pref_extract_windowShape (), my pref_extract_relativeWidth (), my pref_extract_preserveTimes ()); Thing_setName (extract.peek(), GET_STRING (U"Name")); Editor_broadcastPublication (me, extract.transfer()); EDITOR_END }
static void menu_cb_learnOneFromPartialOutput (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one from partial adult output", 0) LABEL (U"", U"Partial adult surface form (e.g. overt form):") SENTENCE (U"Partial output", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) NATURAL (U"Number of chews", U"1") EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one from partial output"); OTGrammar_learnOneFromPartialOutput ((OTGrammar) my data, GET_STRING (U"Partial output"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), GET_INTEGER (U"Number of chews"), TRUE); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_learnOne (EDITOR_ARGS) { EDITOR_IAM (OTGrammarEditor); EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...") LABEL (U"", U"Underlying form:") SENTENCE (U"Input string", U"") LABEL (U"", U"Adult surface form:") SENTENCE (U"Output string", U"") REAL (U"Evaluation noise", U"2.0") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") BOOLEAN (U"Honour local rankings", 1) EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one"); OTGrammar_learnOne ((OTGrammar) my data, GET_STRING (U"Input string"), GET_STRING (U"Output string"), GET_REAL (U"Evaluation noise"), GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Honour local rankings"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading"), TRUE, TRUE, NULL); OTGrammar_sort ((OTGrammar) my data); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }
static void menu_cb_learnOne (EDITOR_ARGS) { EDITOR_IAM (OTMultiEditor); EDITOR_FORM (U"Learn one", U"OTGrammar: Learn one...") OPTIONMENU_ENUM (U"Update rule", kOTGrammar_rerankingStrategy, kOTGrammar_rerankingStrategy_SYMMETRIC_ALL) OPTIONMENU (U"Direction", 3) OPTION (U"forward") OPTION (U"backward") OPTION (U"bidirectionally") REAL (U"Plasticity", U"0.1") REAL (U"Rel. plasticity spreading", U"0.1") EDITOR_OK EDITOR_DO Editor_save (me, U"Learn one"); Melder_free (my form1); Melder_free (my form2); my form1 = GuiText_getString (my form1Text); my form2 = GuiText_getString (my form2Text); OTMulti_learnOne ((OTMulti) my data, my form1, my form2, GET_ENUM (kOTGrammar_rerankingStrategy, U"Update rule"), GET_INTEGER (U"Direction"), GET_REAL (U"Plasticity"), GET_REAL (U"Rel. plasticity spreading")); Graphics_updateWs (my g); Editor_broadcastDataChanged (me); EDITOR_END }