public string BuildText(string textTemplate, SpeechAct speechAct, Dictionary<string, string> parameters) { string text = textTemplate; foreach(SpeechTag tag in speechAct.Tags) { if (parameters.ContainsKey(tag.ParameterName)) { text = text.Replace(tag.Tag, parameters[tag.ParameterName]); } } return text; }
public static SpeechDB CreateExampleFile() { SpeechDB speechExample = new SpeechDB(); for (int i = 0; i < 3; i++) { SpeechAct sa = new SpeechAct(); sa.SpeechType = "SpeechType" + i; for(int j=0; j<3; j++) { sa.Speech.Add("Speech " + j + " for " + sa.SpeechType); } for(int j=0; j<3; j++) { SpeechTag st = new SpeechTag(); st.ParameterName = "SpeechTag" + j + sa.SpeechType; st.Tag = "ST" + i.ToString() + j.ToString(); sa.Tags.Add(st); } speechExample.SpeechActs.Add(sa); } return speechExample; }
private void PopulateDataView(DataGridView dgv, SpeechAct speechAct) { dgv.Rows.Clear(); foreach (SpeechTag t in speechAct.Tags) { string[] row = { t.Tag, t.ParameterName, "" }; dgv.Rows.Add(row); } }