internal int GetParaphraseCount(SLUFactory sluFactory) { AnnotatedQuestionActionEntry lastAction = null; foreach (var action in ExplanationTurns) { if (lastAction != null && lastAction.Act.StartsWith("RequestExplanation")) { break; } lastAction = action; } if (lastAction == null) { throw new NotImplementedException(); } if (isInform(lastAction, sluFactory)) { return(1); } return(0); }
internal string GetAnnotation(AnnotatedQuestionActionEntry entry) { string annotation; _dialogAnnotations.TryGetValue(entry.Entry.ActionIndex, out annotation); return(annotation); }
private void Register(AnnotatedQuestionActionEntry action) { if (action.IsDialogStart) { _question = action.ParseQuestion(); _answerId = _questions.GetAnswerMid(_question); } if (!action.IsRegularTurn) { //we want regular turns only return; } if (action.Act != null && action.Act.StartsWith("RequestAnswer")) { _isAnswerPhase = true; } if (_isAnswerPhase) { _answerTurns.Add(action); } else { _explanationTurns.Add(action); } }
internal void SetAnnotation(AnnotatedQuestionActionEntry entry, string annotation) { if (annotation == null) { _dialogAnnotations.Remove(entry.Entry.ActionIndex); } else { _dialogAnnotations[entry.Entry.ActionIndex] = annotation; } }
private bool isInform(AnnotatedQuestionActionEntry action, SLUFactory sluFactory) { var slu = sluFactory.GetBestDialogAct(UtteranceParser.Parse(action.Text)); if (slu is DontKnowAct || slu is NegateAct || slu is ChitChatAct || slu is AffirmAct) { return(false); } return(true); }
internal AnnotatedPhraseDialog(AnnotatedDialogLogFile log, string question, string answerId, IEnumerable <string> answerNames, IEnumerable <AnnotatedQuestionActionEntry> explanationTurns, IEnumerable <AnnotatedQuestionActionEntry> answerTurns) { _log = log; Question = question; AnswerId = answerId; AnswerNames = answerNames; ExplanationTurns = explanationTurns.ToArray(); AnswerTurns = answerTurns.ToArray(); OpeningTurn = ExplanationTurns.First(); Annotation = _log.GetAnnotation(OpeningTurn); }
private Dictionary <string, object> getUserSlu(AnnotatedQuestionActionEntry userAction, SLUFactory sluFactory) { var slu = sluFactory.GetBestDialogAct(UtteranceParser.Parse(userAction.Text)); if (slu is DontKnowAct || slu is NegateAct || slu is ChitChatAct || slu is AffirmAct) { return(slu.GetDialogAct().ToDictionary()); } return(new Dictionary <string, object>() { { "act", "Inform" }, { "text", userAction.Text } }); }