public void GPCallback(NluMgr.match_record record) { // save the record GoldenPathRecords.Add(record); if (record == null) { UnityEngine.Debug.Log("NluPrompt.Callback() : record = null!"); } // make to upper case record.sim_command = record.sim_command.ToUpper(); string text = "NLU : sim_command=<" + record.sim_command + ">"; // subject if (record.command_subject != null && record.command_subject != "") text += " : s=<" + record.command_subject + ">"; // params foreach (NluMgr.sim_command_param param in record.parameters) text += " : p=<" + param.name + "," + param.value + ">"; // missing params foreach (NluMgr.missing_sim_command_param param in record.missing_parameters) text += " : m=<" + param.name + ">"; // readback if (record.readback != null && record.readback != "") text += " : r=<" + record.readback + ">"; // feedback if (record.feedback != null && record.feedback != "") text += " : f=<" + record.feedback + ">"; // save this one GoldenPathStrings[gpIdx].value = text; // kick off next one if ( ++gpIdx < GoldenPathStrings.Count ) { NluMgr.GetInstance().Utterance(GoldenPathStrings[gpIdx].key, "nurse"); } else { // we're done, save the file Serializer<List<StringMap>> serializer = new Serializer<List<StringMap>>(); serializer.Save("GoldenPath.xml",GoldenPathStrings); // do the analysis AnalyzeGoldenPath(GoldenPathRecords); } }
public void Callback(NluMgr.match_record record) { if (record == null) { UnityEngine.Debug.Log("NluPrompt.Callback() : record = null!"); } // make to upper case record.sim_command = record.sim_command.ToUpper(); string text = "<NLU Command> <" + record.sim_command + ">"; // subject if (record.command_subject != null && record.command_subject != "") text += " : s=<" + record.command_subject + ">"; // params foreach (NluMgr.sim_command_param param in record.parameters) text += " : p=<" + param.name + "," + param.value + ">"; // missing params foreach (NluMgr.missing_sim_command_param param in record.missing_parameters) text += " : m=<" + param.name + ">"; // readback if (record.readback != null && record.readback != "") text += " : r=<" + record.readback + ">"; // feedback if (record.feedback != null && record.feedback != "") text += " : f=<" + record.feedback + ">"; Error = ""; InfoDialogMsg idm; #if DEBUG_NLU_CMD idm = new InfoDialogMsg(); idm.command = DialogMsg.Cmd.open; idm.text = text; InfoDialogLoader.GetInstance().PutMessage(idm); #endif #if SHOW_INPUT if ( record.input != null ) { idm = new InfoDialogMsg(); idm.command = DialogMsg.Cmd.open; idm.text = "<NLU input> " + record.input; InfoDialogLoader.GetInstance().PutMessage(idm); } #endif #if SHOW_READBACK if ( record.readback != null && record.readback != "null") { idm = new InfoDialogMsg(); idm.command = DialogMsg.Cmd.open; idm.text = "<NLU readback> " + record.readback; InfoDialogLoader.GetInstance().PutMessage(idm); } #endif #if SHOW_FEEDBACK if ( record.feedback != null && record.feedback != "null") { // send to log idm = new InfoDialogMsg(); idm.command = DialogMsg.Cmd.open; idm.text = "<NLU feedback> " + record.feedback; InfoDialogLoader.GetInstance().PutMessage(idm); // pop up dialog QuickInfoMsg imsg = new QuickInfoMsg(); imsg.title = "NLU Feedback"; imsg.command = DialogMsg.Cmd.open; imsg.text = record.feedback; imsg.h = 200; imsg.timeout = 4.0f; QuickInfoDialog.GetInstance().PutMessage(imsg); } #endif // I really hate doing this but for now it is the best way to handle our only command with parameters if (record.sim_command.Contains("IV:BLOOD") || record.sim_command.Contains("IV:CRYSTAL")) { OrderFluids(record); } else if (record.sim_command == "BAD:COMMAND") { Brain.GetInstance().PlayAudio("BAD:COMMAND:" + (int)UnityEngine.Random.Range(1, 4)); } else if (record.command_subject != null) { // has command subject if (ExecuteCommand(record.sim_command, record.command_subject.ToLower()) == false) { Debug("ExecuteCommand(CMD:" + record.sim_command + ",SUBJECT:" + record.command_subject + ") Failed : debug=" + text + " : Error=" + Error); } } else { // no command subject, find someone to do this... if (ExecuteCommand(record.sim_command) == false) { Debug("ExecuteCommand(CMD:" + record.sim_command + ", No SUBJECT) Failed : debug=" + text + " : Error=" + Error); } } // NLU response if ((record.feedback != null && record.feedback != "") || (record.readback != null && record.readback != "")) { // put up quickinfo with feedback QuickInfoMsg msg = new QuickInfoMsg(); if (record.feedback != null && record.readback != null) { response_title = msg.title = "READBACK/FEEDBACK"; response = msg.text = "SIM_COMMAND <" + record.sim_command + "> : CMD_SUBJECT <" + record.command_subject + "> : READBACK <" + record.readback + "> : FEEDBACK <" + record.feedback + "> : ERROR <" + Error + ">"; } else if (record.feedback != null) { response_title = msg.title = "FEEDBACK"; response = msg.text = "SIM_COMMAND <" + record.sim_command + "> : CMD_SUBJECT <" + record.command_subject + "> : FEEDBACK <" + record.feedback + "> : ERROR <" + Error + ">"; } else if (record.readback != null) { response_title = msg.title = "READBACK"; response = msg.text = "SIM_COMMAND <" + record.sim_command + "> : CMD_SUBJECT <" + record.command_subject + "> : READBACK <" + record.readback + "> : ERROR <" + Error + ">"; } msg.w = 600; msg.h = 200; msg.timeout = 0.0f; //QuickInfoDialog.GetInstance().PutMessage(msg); } //InfoDialogLoader idl = InfoDialogLoader.GetInstance(); //if (idl != null) //{ // InfoDialogMsg msg = new InfoDialogMsg(); // msg.command = DialogMsg.Cmd.open; // msg.text = response; // idl.PutMessage(msg); //} #if DEBUG_CMD_STRINGS if (++cnt > 3) cnt = 0; data = commands[cnt]; #endif }
public void GPCallback(NluMgr.match_record record) { // make to upper case record.sim_command = record.sim_command.ToUpper(); string text = "NLU : sim_command=<" + record.sim_command + ">"; // subject if (record.command_subject != null && record.command_subject != "") text += " : s=<" + record.command_subject + ">"; // params foreach (NluMgr.sim_command_param param in record.parameters) text += " : p=<" + param.name + "," + param.value + ">"; // missing params foreach (NluMgr.missing_sim_command_param param in record.missing_parameters) text += " : m=<" + param.name + ">"; // readback if (record.readback != null && record.readback != "") text += " : r=<" + record.readback + ">"; // feedback if (record.feedback != null && record.feedback != "") text += " : f=<" + record.feedback + ">"; // save this one #if ADD_NLU_RECORDS currCV.NLURecords.Add(record); #endif if ( record.input != currCV.CV.Variations[currVariationIdx] ) currCV.NLUResults.Add(text + " : input=<" + record.input + "> doesn't match Variation"); else currCV.NLUResults.Add(text + " : input=<" + record.input + ">"); // get next result currCV = NextResult(); // kick off next one if ( currCV != null ) { NluMgr.GetInstance().Utterance(currCV.CV.Variations[currVariationIdx], "nurse"); } else { // we're done, save the file Serializer<List<CommandVariationResult>> serializer = new Serializer<List<CommandVariationResult>>(); serializer.Save("CommandVariationResult.xml",CVResults); } }
public void OrderFluids(NluMgr.match_record record) { int bloodDrip=0; int bloodPressure=0; int bloodRapid=0; int salineDrip=0; int salinePressure=0; int salineRapid=0; // figure out what to do based on the record if ( record.sim_command.Contains("IV:BLOOD") ) { int units=0; // get params string param = record.GetParameter("bloodvolume"); if ( param != null ) units = Convert.ToInt32(param); // set to bloodDrip for now bloodDrip = units; } else if ( record.sim_command.Contains("IV:CRYSTAL") ) { int units=0; // get params string param = record.GetParameter("volume"); if ( param != null ) units = Convert.ToInt32(param); // set to bloodDrip for now salineDrip = units; } // do the order Patient patient = ObjectManager.GetInstance().GetBaseObject("Patient") as Patient; if ( patient != null ) { patient.OrderFluids("Dispatcher",bloodDrip,bloodPressure,bloodRapid,salineDrip,salinePressure,salineRapid); } }