예제 #1
0
파일: _reason.go 프로젝트: herokai/escher
func (f *reason) ShortCognize(saw faculty.Sentence) {
	if saw.At(0).Value() == nil || saw.At(1).Value() == nil { // If either of the two most recently updated valves are nil, inaction.
		return
	}
	switch saw.At(2).Valve() { // least recently updated valve, the one being computed
	case "Belief":
		f.x.ReCognize(tree.Explain(saw.AtAsTree("Theory"), saw.AtAsTree("Observation")))
	case "Observation":
		f.x.ReCognize(tree.Predict(saw.AtAsTree("Belief"), saw.AtAsTree("Theory")))
	case "Theory":
		f.x.ReCognize(tree.Generalize(saw.AtAsTree("Belief"), saw.AtAsTree("Observation")))
	}
	panic(7)
}
예제 #2
0
func (f *reason) ShortCognize(short faculty.Sentence) {
	<-f.ready
	if short[0].Value == nil || short[1].Value == nil { // If either of the two most recently updated valves are nil, inaction.
		return
	}
	switch short[2].Valve { // least recently updated valve, the one being computed
	case "Belief":
		f.recognizer.ReCognize(
			tree.Explain(short.AtAsTree("Theory"), short.AtAsTree("Observation")),
		)
	case "Observation":
		f.recognizer.ReCognize(
			tree.Predict(short.AtAsTree("Belief"), short.AtAsTree("Theory")),
		)
	case "Theory":
		f.recognizer.ReCognize(
			tree.Generalize(short.AtAsTree("Belief"), short.AtAsTree("Observation")),
		)
	}
	panic(7)
}