Here's research I have been testing for deductive reasoning.
For one, I have split the Simple If and Thens from the complex version of If and Then reasoning for correct appending purposes and added a User/Global GetResponse, I'll see if I can take it further in a little while, Still under testing.
'RESPOND: DEDUCTIVE REASONING
'This routine learns deductive reasoning in the form: A = B ; B = C; therefore A = C
'It detects sentences in the form If-Then to accommplish this. For example:
' User: If Molly weighs 400 pounds, then Molly is overweight.
' Ultra Hal: I understand the implication.
' User: If Molly is overweight, then Molly's health is in danger.
' Ultra Hal: I see the relationship.
' User: Molly weighs 400 pounds.
' Ultra Hal: Molly's health is in danger.
'HERE WE APPEND NONE COMPLEX DEDUCTIONS.
If HalBrain.CheckTableExistence(Trim(UserName) & "_deductive") = False Then
'Create table for this person if it doesn't exist
HalBrain.CreateTable Trim(UserName) & "_deductive", "TopicSearch", ""
End If
If ImproperNoun = "" Then ImproperNoun = False
If InStr(1, OriginalSentence, " I ", vbTextCompare) > 0 Then ImproperNoun = True
If InStr(1, OriginalSentence, "SOMEONE", vbTextCompare) > 0 Then ImproperNoun = True
If SimpleIf = "" Then SimpleIf = HalBrain.SearchPattern(OriginalSentence, "IF * THEN *", 1)
If SimpleThen = "" Then SimpleThen = HalBrain.SearchPattern(OriginalSentence, "IF * THEN *", 2)
If SimpleIf <> "" And SimpleThen <> "" And ImproperNoun = False Then
HalBrain.AddToTable "deductive", "TopicSearch", Trim(SimpleIf), Trim(SimpleThen)
HalBrain.AddToTable UserName & "_deductive", "TopicSearch", Trim(SimpleIf), Trim(SimpleThen)
End If
HalBrain.DebugWatch ImproperNoun, "ImproperNoun for deductive"
'HERE WE APPEND COMPLEX DEDUCTIONS.
If InStr(Deductive, "==") Then
DeductiveParts = Split(Deductive, "==")
IfPart = DeductiveParts(0)
ThenPart = DeductiveParts(1)
'IfPart = HalBrain.AlphaNumericalOnly(IfPart)
'ThenPart = HalBrain.AlphaNumericalOnly(ThenPart)
If Len(IfPart) > 1 And Len(ThenPart) > 1 Then
HalBrain.AddToTable "deductive", "TopicSearch", Trim(IfPart), Trim(ThenPart)
HalBrain.AddToTable UserName & "_deductive", "TopicSearch", Trim(IfPart), Trim(ThenPart)
End If
End If
'If the sentence is an If-Then statement then record it
If Deductive <> "" Then
'Continue with deductive.
Select Case HalBrain.RandomNum(5)
Case 1
GetResponse = GetResponse & "I see the relationship." & vbCrLf
Case 2
GetResponse = GetResponse & "I understand the connection." & vbCrLf
Case 3
GetResponse = GetResponse & "I will remember that one follows the other." & vbCrLf
Case 4
GetResponse = GetResponse & "Thanks for pointing out the cause and effect." & vbCrLf
Case 5
GetResponse = GetResponse & "Yes, I get that clearly." & vbCrLf
End Select
End If
'Else if the sentence is not an If-Then statement see if it uses an assertion previously recorded
'and respond accordinly
'FIRST ATTEMPT A PRIVATE DEDUCTIVE BEFORE A GLOBAL DEDUCTIVE.
If MasterDeduction = "" Then MasterDeduction = HalBrain.TopicSearch(OriginalSentence, UserName & "_deductive")
If MasterDeduction <> "" Then
GetResponse = MasterDeduction & " " & GetResponse & ". " & vbCrLf
'IF A PRIVATE DEDUCTIVE ISN'T FOUND THEN TRY A GLOBAL DEDUCTION.
If Deduction = "" Then Deduction = HalBrain.TopicSearch(OriginalSentence, "deductive")
ElseIf Deduction <> "" Then
GetResponse = Deduction & " " & GetResponse & ". " & vbCrLf
ElseIf Len(Deduction) < 2 Then
GetResponse = GetResponse & vbCrLf
End If
HalBrain.DebugWatch GetResponse, "Deductive Reasoning"
Jerry[8D]