Update: NAR.c: extend question-based priming to questions with query variables
@@ -110,18 +110,10 @@ void NAR_AddInputNarsese(char *narsese_sentence)
#endif
if(punctuation == '?')
{
- //simplistic priming for Q&A:
- if(!Variable_hasVariable(&term, false, false, true))
- {
- Concept *c = Memory_FindConceptByTerm(&term); //triggers concept RESTORE
- if(c != NULL)
- {
- c->priority = MAX(c->priority, QUESTION_PRIMING);
- }
- }
//answer questions:
Truth best_truth = { .frequency = 0.0, .confidence = 1.0 };
Truth best_truth_projected = { .frequency = 0.0, .confidence = 1.0 };
+ Concept* best_belief_concept = NULL;
Term best_term = {0};
long answerOccurrenceTime = OCCURRENCE_ETERNAL;
long answerCreationTime = 0;
@@ -172,6 +164,7 @@ void NAR_AddInputNarsese(char *narsese_sentence)
best_truth_projected = potential_best_truth;
best_truth = c->belief_spike.truth;
best_term = c->belief_spike.term;
+ best_belief_concept = c;
answerOccurrenceTime = c->belief_spike.occurrenceTime;
answerCreationTime = c->belief_spike.creationTime;
}
@@ -185,6 +178,7 @@ void NAR_AddInputNarsese(char *narsese_sentence)
best_truth_projected = potential_best_truth;
best_truth = c->predicted_belief.truth;
best_term = c->predicted_belief.term;
+ best_belief_concept = c;
answerOccurrenceTime = c->predicted_belief.occurrenceTime;
answerCreationTime = c->predicted_belief.creationTime;
}
@@ -196,11 +190,18 @@ void NAR_AddInputNarsese(char *narsese_sentence)
{
best_truth = c->belief.truth;
best_term = c->belief.term;
+ best_belief_concept = c;
answerCreationTime = c->belief.creationTime;
}
}
Continue:;
}
+ //simplistic priming for Q&A:
+ if(best_belief_concept != NULL)
+ {
+ best_belief_concept->priority = MAX(best_belief_concept->priority, QUESTION_PRIMING);
+ best_belief_concept->usage = Usage_use(best_belief_concept->usage, currentTime, tense == 0 ? true : false);
+ }
fputs("Answer: ", stdout);
if(best_truth.confidence == 1.0)
{
