private void tryActivateProperties() { var existingInstances = GetTurnActivationRequestedInstances(); var existingConcepts = new HashSet <Concept2>(existingInstances.Select(e => e.Instance.Concept)); var concepts = GetDefinedConcepts(); var inputPhrasesHypotheses = GetInputActivationHypotheses(); foreach (var inputPhrases in inputPhrasesHypotheses) { foreach (var concept in concepts) { if (existingConcepts.Contains(concept)) { // prevent concept multi activation continue; } if (!isKnownProperty(concept)) { //don't spam with meaningless property concept activations continue; } var scoreEvent = new InputPhraseScoreEvent(inputPhrases, concept); var score = GetScore(scoreEvent); if (score < Configuration.ConceptActivationThreshold) { // performance optimization continue; } foreach (var inputPhrase in inputPhrases) { Push(new CloseEvent(inputPhrase)); } Push(scoreEvent); Push(new IncompleteRelationEvent(null, concept, null)); Pop(); Pop(); foreach (var inputPhrase in inputPhrases) { Pop(); } } } }
private void tryActivateNewInstances() { var existingInstances = GetTurnActivationRequestedInstances(); var existingConcepts = new HashSet <Concept2>(existingInstances.Select(e => e.Instance.Concept)); var concepts = GetDefinedConcepts(); var inputPhrasesHypotheses = GetInputActivationHypotheses(); foreach (var inputPhrases in inputPhrasesHypotheses) { foreach (var concept in concepts) { if (existingConcepts.Contains(concept)) { // prevent concept multi activation continue; } var scoreEvent = new InputPhraseScoreEvent(inputPhrases, concept); var score = GetScore(scoreEvent); if (score < Configuration.ConceptActivationThreshold) { // performance optimization continue; } foreach (var inputPhrase in inputPhrases) { Push(new CloseEvent(inputPhrase)); } Push(scoreEvent); Push(new InstanceActivationRequestEvent(inputPhrases, new ConceptInstance(concept))); Pop(); Pop(); foreach (var inputPhrase in inputPhrases) { Pop(); } } } }