Author Topic: New Advanced Comprehension Script v.1.6  (Read 2738 times)

onthecuttingedge2005

  • Guest
New Advanced Comprehension Script v.1.6
« on: July 31, 2004, 09:24:15 pm »
'Advanced Comprehension v1.6
'Just copy and paste this script in the middle of your default brain.
'This script allows Hal/Ziggy to comprehend split sentences in a conversation.
'This script self generates .brn files and detection files automatically
'upon conversations with sentences that include commas.

'Advanced Statement Comprehension. v 1.6
'Hal learns to associate split statements and sentences and rationalize an answer.
Dim Comprehend
If HalBrain.TopicSearch(OriginalSentence, WorkingDir & "ComprehendDetection.brn") = "TRUE" And DebugMode = True Then
Comprehend = HalBrain.QABrain(OriginalSentence, WorkingDir & "Comprehending.brn", UserBrainRel)
GetResponse = Comprehend
DebugInfo = DebugInfo & "Hal comprehends the statement: " & Comprehend & vbCrLf
End If
'Save Split sentences but not if Bots name is detected, Put your bots names in place of QuantumHal and BotChampion's name if you have more than one bot.
If InStr(OriginalSentence, "") > 0 And InStr(1, OriginalSentence, ",", 1) > 0 And Not InStr(1, OriginalSentence, "QuantumHal", vbTextCompare) > 0 And Not InStr(1, OriginalSentence, "BotChampion", vbTextCompare) > 0 Then
SentPieces = Split(OriginalSentence, ",", 2, vbTextCompare)
SubPhrase = Trim(SentPieces(0))
PredPhrase = Trim(SentPieces(1))
SubPhrase = HalBrain.AlphaNumericalOnly(SubPhrase)
PredPhrase = HalBrain.AlphaNumericalOnly(PredPhrase)
HalBrain.AppendFile WorkingDir & "ComprehendDetection.brn", """" & SubPhrase & """,""" & "TRUE" & """"
HalBrain.AppendFile WorkingDir & "Comprehending.brn", "@" & PredPhrase & vbCrLf & " " & Trim(UCase(SubPhrase))
DebugInfo = DebugInfo & "Hal has detected a new split sentence and saved it: " & GetResponse & vbCrLf
End If

'Best of wishes and brand new discoveries.
'Jerry.