private static void WriteIntent(XmlWriter xw, MatchIntentAndEntities intent) { xw.WriteStartElement("Intent"); xw.WriteAttributeString("Name", intent.Name); if (!String.IsNullOrEmpty(intent.Folder)) { xw.WriteAttributeString("Folder", intent.Folder); } if (intent.Questions.Count > 0) { xw.WriteStartElement("Questions"); foreach (string question in intent.Questions) { xw.WriteElementString("string", question); } xw.WriteEndElement(); } if (intent.EntityMatches.Count > 0) { xw.WriteStartElement("EntityValues"); foreach (var entityMatch in intent.EntityMatches) { WriteEntityMatch(xw, entityMatch); } xw.WriteEndElement(); } WriteChildrenNodes(xw, intent); xw.WriteEndElement(); }
public void AddMatchIntentAndEntities(MatchIntentAndEntities intent) { if (Variables.ContainsKey("CLASSIFIER_CLASS_0")) { var intentVariable = Variables["CLASSIFIER_CLASS_0"]; var variableAssignment = new DialogVariableAssignment(intentVariable, DialogVariableOperator.SetTo, intent.Name); intent.AddVariableAssignment(variableAssignment); AddDialogVariableAssignment(variableAssignment, intent.Type); } AddEntityMatches(intent.EntityMatches); }
internal void AddIntent(MatchIntentAndEntities intent, DialogVariablesSimulator dialogVariables) { if (!Intents.ContainsKey(intent.Name)) { Intents.Add(intent.Name, intent); dialogVariables.AddMatchIntentAndEntities(intent); } else { var otherIntent = Intents[intent.Name]; LogMessage(intent.LineNumber, MessageType.DuplicateKey, "Two intent matching nodes found for intent \"" + intent.Name + "\" : line " + intent.LineNumber + " and line " + otherIntent.LineNumber); } }
public static DialogExecutionResult AnalyzeInitialQuestion(Dialog dialog, string questionId, string questionText, string intentName) { var result = new DialogExecutionResult(questionId, questionText, intentName); MatchIntentAndEntities intent = null; if (!dialog.Intents.TryGetValue(intentName, out intent)) { intent = dialog.Intents.Values.Where(i => i.Name.EndsWith(intentName)).FirstOrDefault(); } if (intent != null) { ExecuteUserInputNode(dialog, intent, questionText, result); } else { result.LogMessage("Intent name " + intentName + " undefined in dialog file " + dialog.FilePath); } return(result); }