Exemplo n.º 1
0
        internal ExplicitStateDialogManager(HeuristicQAModule qa)
        {
            _currentState = new DialogState(qa);

            Add <AskEquivalenceDifferenceAction>();
            Add <AcceptEquivalenceAdvice>();
            Add <EquivalenceQuestionAction>();
            Add <QuestionAnsweringAction>();
            Add <NoAdviceApologizeAction>();
            Add <AcceptAdviceAction>();
            Add <RequestAdviceAction>();
            Add <WelcomeAction>();
            Add <HowCanIHelpYouAction>();
        }
Exemplo n.º 2
0
        private static void ExplicitStateDialog(string dbPath)
        {
            var loader   = loadDB(dbPath);
            var qa       = new PoolComputation.HeuristicQAModule(new ComposedGraph(loader.DataLayer), new CallStorage(null));
            var manager  = new PoolComputation.ExplicitStateDialogManager(qa);
            var provider = new DialogConsole(manager);

            provider.SimulateInput(
                "François Hollande is president in which state ?",
                "It is France",
                "Barack Obama is president of which state ?",
                "yes",
                "dont know"
                );

            provider.Run();
        }
Exemplo n.º 3
0
        private string substitute(ParsedUtterance pattern, ParsedUtterance utterance)
        {
            var patternNodes   = _context.QuestionAnsweringModule.GetPatternNodes(pattern);
            var utteranceNodes = _context.QuestionAnsweringModule.GetRelatedNodes(utterance).ToArray();
            var substitutions  = HeuristicQAModule.GetSubstitutions(utteranceNodes, patternNodes, _context.Graph);

            var result = repairSpelling(pattern.OriginalSentence);

            foreach (var patternNode in patternNodes)
            {
                NodeReference substitution;
                if (!substitutions.TryGetValue(patternNode, out substitution))
                {
                    substitution = patternNode;
                }

                result = result.Replace(patternNode.Data.ToString(), substitution.Data.ToString());
            }

            return(result);
        }