Zabaware Support Forums
Zabaware Forums => Ultra Hal 7.0 => Topic started by: onthecuttingedge2005 on August 02, 2003, 02:53:50 pm
-
'I was playing with my own Global
'strings script and this is what I came up with.
'this script saves all user strings into one single
'file called user_strings.brn
'this part below is (optional)- this script file
'can also be modified to recall previous user strings if the
'user asks for recall, example keywords are "do you recall"
'and "do you remember", "don't forget" and so forth
'in which the keywords are put in quote within the
'UserSentence = "" in the choose sentence from file.
'Just copy and paste this script below and replace
'the 'SAVE: FILE USER STRINGS in your default brain.
'copy and replace these files with the ones in your
'brain file.
'SAVE: FILE USER STRINGS
'This routine saves the users response. Later a function will extract 15-character strings
'from the beginning, end, and middle of the user's remark for possible later response.
UserSentence = " " & Trim(UserSentence) & " "
If Len(UserSentence) > 20 And Len(UserSentence) < 90 Then
If Learninglevel > 1 Then HalBrain.AppendFile WorkingDir & "user_strings.brn", " " & Trim(SpecialSent)
End If
If InStr(1, UserSentence, "", 1) > 0 Then
HalBrain.AppendFile WorkingDir & "user_strings.brn", " " & Trim(SpecialSent)
End If
'SAVE: FILE USER SENTENCE DEFAULT
'Unless the user seems to be asking for data recall, Hal always adds
'to the default brain user sentence file an association of the current
'user sentence With words selected from that same current user sentence.
If InStr(UserSentence, "WHAT IS") = 0 And Responding = False Then
AnswerSent = "@" & Trim(SpecialSent)
QuestionSent = " " & Trim(HalBrain.ExtractKeywords(UserSentence))
If HalBrain.CountInstances(" ", QuestionSent) > 3 And Len(AnswerSent) > 8 And Len(QuestionSent) > 8 And InStr(1, AnswerSent, " ", vbTextCompare) > 0 Then
If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & "usersent.brn", AnswerSent & vbCrLf & QuestionSent
If InStr(1, UserSentence, "", 1) > 0 Then
HalBrain.AppendFile WorkingDir & "usersent.brn", AnswerSent & vbCrLf & QuestionSent
End If
End If
End If
'SAVE: FILE SHARED USER SENTENCES
'Unless the user seems to be asking for data recall, or talking about
'himself or herself, Hal adds to a shared user sentence file. This allows
'Hal to gain knowledge that he can apply to conversations with multiple users.
If Responding = False And InStr(UserSentence, "WHAT IS") = 0 And InStr(UserSentence, " YOU ") = 0 And InStr(UserSentence, " YOU'") = 0 And InStr(UserSentence, " YOUR ") = 0 And InStr(UserSentence, " YOURS ") = 0 And InStr(UserSentence, " YOURSELF ") = 0 And InStr(UserSentence, " WE ") = 0 And InStr(UserSentence, " US ") = 0 And InStr(UserSentence, " OUR ") = 0 And InStr(UserSentence, " I ") = 0 And InStr(UserSentence, " ME ") = 0 And InStr(UserSentence, " MY ") = 0 And InStr(UserSentence, " MINE ") = 0 And InStr(UserSentence, " MYSELF ") = 0 And InStr(UserSentence, " I' ") = 0 Then
AnswerSent = "@" & Trim(SpecialSent)
QuestionSent = " " & Trim(HalBrain.ExtractKeywords(UserSentence))
If HalBrain.CountInstances(" ", QuestionSent) > 3 And Len(AnswerSent) > 8 And Len(QuestionSent) > 8 And InStr(1, AnswerSent, " ", vbTextCompare) > 0 And BlockSave = False Then
If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & "shared_usersent.brn", AnswerSent & vbCrLf & QuestionSent
If InStr(1, UserSentence, "", 1) > 0 Then
HalBrain.AppendFile WorkingDir & "shared_usersent.brn", AnswerSent & vbCrLf & QuestionSent
End If
End If
End If
'SAVE: FILE ADDRESS AND NUMBER BACKUP
'Unless the user seems to be asking for data recall, Hal will also put
'sentences that have to Do with addresses and numbers into a special
'user recall file that adds a backup source for factual data.
If InStr(UserSentence, "WHAT IS") = 0 And InStr(UserSentence, "ADDRESS") > 0 Or InStr(UserSentence, "NUMBER") > 0 Then
AnswerSent = "@" & Trim(SpecialSent)
QuestionSent = " " & Trim(HalBrain.ExtractKeywords(UserSentence))
If HalBrain.CountInstances(" ", QuestionSent) > 2 And Len(AnswerSent) > 8 And Len(QuestionSent) > 8 And InStr(1, AnswerSent, " ", vbTextCompare) > 0 Then
If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & "user_recall.brn", AnswerSent & vbCrLf & QuestionSent
If InStr(1, UserSentence, "", 1) > 0 Then
HalBrain.AppendFile WorkingDir & "user_recall.brn", AnswerSent & vbCrLf & QuestionSent
End If
End If
End If
'SAVE TOPIC SENTENCE IN APPROPRIATE FILE IF CURRENTLY IN TOPICFOCUS MODE
If TopicFocus > 10 And TopicFocus = FocusFileNum Then
AnswerSent = "@" & Trim(SpecialSent)
QuestionSent = " " & Trim(HalBrain.ExtractKeywords(UserSentence))
If HalBrain.CountInstances(" ", QuestionSent) > 2 And Len(AnswerSent) > 8 And Len(QuestionSent) > 8 And InStr(1, AnswerSent, " ", vbTextCompare) > 0 And BlockSave = False Then
If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & "topic" & FocusFileNum & ".brn", AnswerSent & vbCrLf & QuestionSent
If InStr(1, UserSentence, "", 1) > 0 Then
HalBrain.AppendFile WorkingDir & "topic" & FocusFileNum & ".brn", AnswerSent & vbCrLf & QuestionSent
End If
End If
End If
'Best of wishes and new discoveries.
'Jerry
-
umm so you just paste this into the brain editor and it makes hall remember stuf?