public Ranked <IEnumerable <NodeReference> > GetRankedAnswer(string question, ContextPool pool)
        {
            //keep original pool non-modified
            pool = pool.Clone();

            var parsedQuestion = UtteranceParser.Parse(question);
            var covers         = FeatureCover.GetFeatureCovers(parsedQuestion, Graph);

            var interpretations = _mapping.GetRankedInterpretations(covers);
            var bestMatch       = interpretations.BestMatch;

            if (bestMatch.Value == null)
            {
                //no interpretation has been found
                return(new Ranked <IEnumerable <NodeReference> >(new NodeReference[0], 0.0));
            }

            var bestInterpretation         = bestMatch.Value.Item2.Interpretation;
            var bestCover                  = bestMatch.Value.Item1;
            var instantiatedInterpretation = bestInterpretation.InstantiateBy(bestCover, Graph);

            //run the interpretation on the pool
            Console.WriteLine("\n");
            foreach (var rule in instantiatedInterpretation.Rules)
            {
                rule.Execute(pool);
                Console.WriteLine(rule);
                Console.WriteLine("POOL: " + string.Join(" ", pool.ActiveNodes));
            }

            return(new Ranked <IEnumerable <NodeReference> >(pool.ActiveNodes, bestMatch.Rank));
        }
        internal InterpretationGenerator(IEnumerable <FeatureCover> covers, InterpretationsFactory interpretations, ContextPool context, ProbabilisticQAModule owner)
        {
            var coversCopy = covers.ToArray();

            if (coversCopy.Length == 0)
            {
                throw new NotSupportedException("Cannot create InterpretationGenerator without feature covers");
            }

            Covers = coversCopy;

            _interpretations = interpretations;
            _context         = context.Clone();
            _owner           = owner;
            _topicSelector   = interpretations.GetTopicSelector(owner.Graph);
            if (_topicSelector.MoveNext())
            {
                //initialize constraint selector
                _currentConstraintSelector = interpretations.GetConstraintSelector(owner.Graph, _topicSelector.SelectedNodes);
            }
        }
 internal ContextPool CreateContextPoolCopy()
 {
     return(_context.Clone());
 }