public DialogueAct(Agent agent=null, SortedList speechContext = null, SortedList gestureContext = null, DialogueActType dlgActType = DialogueActType.Unknown) { this._dlgActType = dlgActType; this._speechContext = speechContext; this._gestureContext = gestureContext; this._agent = agent; }
public DialogueManager(string context, ArcMapManager mapMgr, string kbase) { this._context = context; this._dlgID = Utility.GetUniqueKey(); this._exec = new Executor(mapMgr); this._kbase = new SQLiteKBase(kbase); ; this._participants = new ArrayList(); this._initiator = null; this._parser = new SimpleParser(); }
public override DialogueAct Parse(SortedList speech, SortedList gesture, Agent agent) { DialogueAct dlgAct = null; // Test for actions if (speech.ContainsKey("intention")) { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Intend); return dlgAct; } if (this._prevDlgResp != null && this._prevDlgResp.Count > 0) { // Test for answer to previous questions foreach (DialogueResponse resp in this._prevDlgResp) { if (resp.DlgRespType == DialogueResponseType.speechQuestion || resp.DlgRespType == DialogueResponseType.listPlainOptions || resp.DlgRespType == DialogueResponseType.listMapLayerOptions || resp.DlgRespType == DialogueResponseType.listOptionsWithExamples) { if (speech.ContainsKey("affirmative")) { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Accept); } else if (speech.ContainsKey("negative")) { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Reject); } else { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Answer); } return dlgAct; } } // Test for feedback to previous actions foreach (DialogueResponse resp in this._prevDlgResp) { if (resp.DlgRespType == DialogueResponseType.drawPolygonStarted) { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Feedback); return dlgAct; } else if (resp.DlgRespType == DialogueResponseType.selectByAttributes) { dlgAct = new DialogueAct(agent, speech, gesture, DialogueActType.Feedback); return dlgAct; } } } return dlgAct; }
public Agent SearchAgent(Agent tempAgent) { foreach (Agent agent in this._agents) { if (agent.ID == tempAgent.ID) { return agent; } } return null; }
public abstract DialogueAct Parse(SortedList speech, SortedList gesture, Agent agent);
public Agent NewParticipant(string id="", string name="") { foreach(Agent p in this._participants) { if (p.ID == id) { return p; } } Agent newP = new Agent(id, name); this._participants.Add(newP); // set the first participant as the initator if (this._participants.Count == 1) { this._initiator = newP; } return newP; }
public ArrayList Update(SortedList speech, SortedList gesture=null, Agent agent=null) { ArrayList respList = new ArrayList(); if (speech == null && gesture == null) { respList.Add(new DialogueResponse(DialogueResponseType.speechError, "invalid input")); return respList; } if (agent != null) { agent = this.NewParticipant(agent.ID, agent.Name); } else { if (this._initiator != null) { agent = this._initiator; } else { respList.Add(new DialogueResponse(DialogueResponseType.speechError, "There is no agent specified yet!")); return respList; } } // Parse the input to a dialogue act (map one input to one dialogue act) this._currDlgAct = this._parser.Parse(speech, gesture, agent); // Explain the parsed dialogue act if (this._currDlgAct == null) { respList.Add(new DialogueResponse(DialogueResponseType.speechError, "The input cannot be recognized!")); return respList; } bool isExplained = this._planGraph.Explain(this._currDlgAct); if (isExplained == false) { respList.Add(new DialogueResponse(DialogueResponseType.speechError, "The input cannot be interpreted!")); return respList; } // Elaborate the plan and process the response respList = this._planGraph.Elaborate(); this._parser.SetPrevDlgResponse(respList); return respList; }