private ArrayList AskForPartiality(ActionNode actionNode, DialogueAct currDlgAct) { ArrayList respList = new ArrayList(); if (actionNode.ActState == ActionState.Initiated) { // change its own state actionNode.ActState = ActionState.Executing; // do something: generate the candiate list respList.Add(new DialogueResponse(DialogueResponseType.debugInfo, "Basic Action: AskForPartiality")); ParamNode paramNode = (ParamNode)actionNode.Parent; if (paramNode.Name == "partiality") { // only respond if the need_summary is true ActionNode parentNode = ((ActionNode)(paramNode.Parent)); bool need_summary = false; foreach (ParamNode param in parentNode.Params) { if (param.Name == "need_summary") { if (param.Values.Count > 0) { need_summary = ((bool)param.Values[0]); } } } if (need_summary == true) { // fixed at the moment OptionWithExampleListData respContent = new OptionWithExampleListData(); respContent.Opening = this._generateQuestionString(paramNode); respContent.Opening = "Do you want to map them partially or fully inside? The comparison of difference between partially and fully inside are shown in the popup window."; respContent.AddOption(new OptionWithExampleItemData("the parts inside", "Only the parts of features inside the region should be taken into account", "/CAGA;component/Images/partial2.png")); respContent.AddOption(new OptionWithExampleItemData("the features as a whole", "The inside features as a whole should be taken into account", "/CAGA;component/Images/full2.png")); respList.Add(new DialogueResponse(DialogueResponseType.listOptionsWithExamples, respContent)); return respList; } } } // if the action is executing, try to check whether the current input answers the question else if (actionNode.ActState == ActionState.Executing) { ParamNode paramNode = (ParamNode)actionNode.Parent; foreach (string phrase in currDlgAct.SpeechContext.Keys) { if (phrase.ToLower() == paramNode.Name.ToLower()) { object newValue = this._parseValueFromSpeech(paramNode, currDlgAct.SpeechContext[phrase]); if (newValue != null) { this._addValueToParam(paramNode, newValue); // change its own state actionNode.ActState = ActionState.Complete; return respList; } } } } // change its own state actionNode.ActState = ActionState.Complete; // generate response return respList; }
private ArrayList IdentifyRegionType(ActionNode actionNode, DialogueAct currDlgAct) { ArrayList respList = new ArrayList(); if (actionNode.ActState == ActionState.Initiated) { // change its own state actionNode.ActState = ActionState.Executing; // do something: generate the candiate list respList.Add(new DialogueResponse(DialogueResponseType.debugInfo, "Basic Action: IdentifyRegionType")); ParamNode paramNode = (ParamNode)actionNode.Parent; if (paramNode.Name == "region_type") { // fixed at the moment OptionWithExampleListData respContent = new OptionWithExampleListData(); respContent.Opening = this._generateQuestionString(paramNode); respContent.Opening = "Please describe exactly the region you are interested in. You may choose one of the three methods:"; respContent.AddOption(new OptionWithExampleItemData("Draw the region manually on the map", "The region is drawn manually", "/CAGA;component/Images/region_drawing.png")); respContent.AddOption(new OptionWithExampleItemData("Define a region from selection of area features", "The region is a set of areal features", "/CAGA;component/Images/region_attributes.png")); respContent.AddOption(new OptionWithExampleItemData("Define region from neighborhood of selected features", "The region is a buffer zone around some feature", "/CAGA;component/Images/region_buffer.png")); respList.Add(new DialogueResponse(DialogueResponseType.listOptionsWithExamples, respContent)); return respList; } } // if the action is executing, try to check whether the current input answers the question else if (actionNode.ActState == ActionState.Executing) { ParamNode paramNode = (ParamNode)actionNode.Parent; foreach (string phrase in currDlgAct.SpeechContext.Keys) { if (phrase.ToLower() == paramNode.Name.ToLower()) { object newValue = this._parseValueFromSpeech(paramNode, currDlgAct.SpeechContext[phrase]); if (newValue != null) { this._addValueToParam(paramNode, newValue); // change its own state actionNode.ActState = ActionState.Complete; return respList; } } } } // change its own state actionNode.ActState = ActionState.Complete; // generate response return respList; }