示例#1
0
        internal BodyState SetPointer(Phrase phrase, RankedConcept concept)
        {
            var newPointings = new Dictionary <Phrase, RankedConcept>(_pointings);

            newPointings.Add(phrase, concept);

            return(new BodyState(Score + concept.Rank, _input, _values, newPointings, _parameterRequirements, _multiParameterRequirements));
        }
示例#2
0
        private IEnumerable <BodyState> setPointer(BodyState inputState, Phrase phrase, Concept concept, double pointingProbability)
        {
            if (pointingProbability <= 0)
            {
                yield break;
            }

            var rankedConcept = new RankedConcept(concept, pointingProbability);
            var state         = inputState.SetPointer(phrase, rankedConcept);
            var context       = new BodyContext(rankedConcept, _body, state);

            context.EvaluateActivation(concept);

            yield return(context.CurrentState);

            var assignmentInitialState = context.CurrentState;

            //try parameter assignments
            foreach (var requirement in assignmentInitialState.PendingRequirements)
            {
                foreach (var mentionedConcept in assignmentInitialState.RecentMentionedConcepts)
                {
                    if (mentionedConcept == requirement.RequestingConcept.Concept)
                    {
                        //don't allow self assignments
                        continue;
                    }

                    var newState = assignParameter(assignmentInitialState, requirement, mentionedConcept);
                    if (newState != null)
                    {
                        yield return(newState);
                    }
                }
            }
        }
示例#3
0
 public BodyContext(RankedConcept evaluatedConcept, Body body, BodyState inputState)
 {
     _body            = body;
     _currentState    = inputState;
     EvaluatedConcept = evaluatedConcept;
 }
 internal ConceptRequirement(string request, RankedConcept requestingConcept, IEnumerable <Concept> domain)
 {
     Request           = request;
     RequestingConcept = requestingConcept;
     Domain            = domain.ToArray();
 }