· 8 years ago · Mar 10, 2018, 01:36 PM
1Rem Type=Plugin
2Rem Name=S.A.L.L.I.E 2.0
3Rem Author= Doonycram, vonsmith, Gerald L. Blakley A.K.A OnTheCuttingEdge2005, jasondude7116, Robert Medeksza, Cyberjedi,
4Rem Host=Assistant
5
6Rem PLUGIN: SCRIPT_LOAD
7Script_Load = Script_Load & "<DREAMOUTLOUD>"
8
9Rem PLUGIN: SCRIPT_LOAD
10
11
12
13'RESPOND: USER EXPRESSES AN EXPLANATION
14 'This routine detects common expressions of reasons from the user,
15 'and allows Hal to react to the explanation.
16'=vonsmith Added GetResponseBlock.
17 If HalBrain.TopicSearch(UserSentence, WorkingDir & "Explaining.brn") = "True" And GetResponseBlock <> True Then
18 ExplainSentence = UserSentence
19 'We don't want pronouns to confuse HalBrain
20 'or get mixed up in processing, so we encode them
21 'to make the pronouns go through processing unchanged:
22 ExplainSentence = HalBrain.EncodePronouns(ExplainSentence)
23 ExplainPhrase = HalBrain.KeywordBrain(ExplainSentence, WorkingDir & "reason_detector.brn", False)
24 If Len(ExplainPhrase) > 1 And Len(ExplainPhrase) < 60 Then
25 'Now that we've extracted the user's intent phrase, we decode the pronouns and put them back as we found them:
26 ExplainPhrase = HalBrain.DecodePronouns(ExplainPhrase)
27 If Rnd * 150 < 75 Then IntroExclaim = HalBrain.ChooseSentenceFromFile(WorkingDir & "IntroExlaim4.brn")
28 Enlightener = HalBrain.ChooseSentenceFromFile(WorkingDir & "Enlightener.brn")
29 If Rnd * 100 < 75 Then SuffixComment = HalBrain.ChooseSentenceFromFile(WorkingDir & "SuffixComment4.brn")
30 Spinner = Int(Rnd * 1)
31 If Spinner = 1 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
32 If Spinner = 23 Then GetResponse = " " & " <UserName> " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
33 If Spinner = 2 Then GetResponse = " " & IntroExclaim & " <UserName> " & Enlightener & ExplainPhrase & SuffixComment & " "
34 If Spinner = 3 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & " <UserName> " & SuffixComment & " "
35 If Spinner = 4 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " <UserName> " & " "
36 If Spinner = 5 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
37 DebugInfo = DebugInfo & "The user has expressed a explanation and Hal has responded: " & GetResponse & vbCrLf
38 End If
39 End If
40
41'PROCESS: USER SENTENCE FOR KEYWORD BRAINS
42 'This routine allows Hal to learn keyword files with correct pronoun reversals and some of
43 'the user's punctuation intact, especially question marks and exclamation points. We learn
44 'from the user's sentence if it contains linking verbs. In this first section Hal
45 'preprocesses the user's sentence. Later we save into one of several user keyword brain files.
46 'Before we go further, we save a copy
47 'of the pronoun-reversed user's sentence.
48 SaveUserSentence = UserSentence
49 UserSentence = HalBrain.RemovePronouns(UserSentence)
50 'Now Hal makes keywords and responses with no confusion over pronouns:
51 learninfo = HalBrain.Learn(UserSentence)
52 LearnKeyword = HalBrain.DecodeVar(learninfo, "LearnKeyword")
53 LearnKeyword2 = HalBrain.DecodeVar(learninfo, "LearnKeyword2")
54 Response1 = HalBrain.DecodeVar(learninfo, "Response1")
55 Response2 = HalBrain.DecodeVar(learninfo, "Response2")
56 Response3 = HalBrain.DecodeVar(learninfo, "Response3")
57 LearnKeyword = Trim(LearnKeyword)
58 'Remember, all thinking is done in all caps. To the extent possible, we recover some punctuation
59 'at this point from the user's original sentence, and add some spaces before and after the
60 'sentence which are useful when Hal retrieves more than one keyword response at a time from any
61 'of the databases. We start by restoring the pronouns into the user's sentence again:
62 UserSentence = SaveUserSentence
63 'Now we establish a special sentence on which we can restore ordinary capitalization:
64 SpecialSent = UserSentence
65 SpecialSent = HalBrain.FixCaps(SpecialSent)
66 'Now we add in our spaces and restore ending punctuation to match the user's original sentence:
67 If InStr(OriginalSentence, ".") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", ".", 1, -1, vbTextCompare)
68 If InStr(OriginalSentence, "?") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", "?", 1, -1, vbTextCompare)
69 If InStr(OriginalSentence, "!") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", "!", 1, -1, vbTextCompare)
70 'If there were no pronoun reversals required in the sentence,
71 'we can recover directly from the original sentence:
72 If InStr(UserSentence, " ME") = 0 And InStr(UserSentence, "YOU") = 0 And InStr(UserSentence, "MY ") = 0 And InStr(UserSentence, "YOUR ") = 0 And InStr(UserSentence, "I ") = 0 And InStr(UserSentence, "MINE") = 0 And InStr(UserSentence, "YOURS") = 0 And InStr(UserSentence, "MYSELF") = 0 And InStr(UserSentence, "YOURSELF") = 0 Then SpecialSent = OriginalSentence
73 'SAVE FILE USER DEFAULT KEYWORD BRAIN
74 'Here we save any information learned in the default user keyword brain file for compatibility.
75 If HalBrain.CheckLinkingVerb(UserSentence) = True Then
76 LearnKeyword = Replace("" & LearnKeyword & "", " EMAIL ADDRESS ", " EMAIL ", 1, -1, vbTextCompare)
77 If Len(LearnKeyword) > 4 And Len(LearnKeyword2) > 4 And BlockSave = False Then
78 If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user.brn", """" & LearnKeyword & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword2 & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
79 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user.brn" & vbCrLf
80 End If
81 'SAVE FILE USER BACKUP ADDRESS BRAIN
82 'Here we save any information learned
83 'about numbers and addresses.
84 If InStr(OriginalSentence, "ADDRESS") > 0 Then BackupData = True
85 If InStr(OriginalSentence, "MAIL") > 0 Then BackupData = True
86 If InStr(OriginalSentence, "PHONE") > 0 Then BackupData = True
87 If InStr(OriginalSentence, "NUMBER") > 0 Then BackupData = True
88 If InStr(OriginalSentence, "address") > 0 Then BackupData = True
89 If InStr(OriginalSentence, "mail") > 0 Then BackupData = True
90 If InStr(OriginalSentence, "phone") > 0 Then BackupData = True
91 If InStr(OriginalSentence, "number") > 0 Then BackupData = True
92 If InStr(OriginalSentence, "what is") > 0 Then BackupData = False
93 If InStr(OriginalSentence, "where is") > 0 Then BackupData = False
94 If BackupData = True Then
95 If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_backup.brn", """" & Left(OriginalSentence, 15) & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
96 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user_backup.brn" & vbCrLf
97 End If
98 'SAVE FILE USER KEYWORD BRAIN 0 1 2
99 'Hal now also selects and writes to one of three keyword files at random. The use of
100 'these three user keyword files provides more variety of responses when it is not
101 'necessary to search for specific factual data. In these files, we only accept words
102 'and phrases with a length greater than 9 in order to reduce repetitive-triggering on
103 'short common words.
104 If Len(LearnKeyword) > 9 And Len(LearnKeyword2) > 9 And BlockSave = False Then
105 LearnKeyword_A = Left(LearnKeyword, 20)
106 LearnKeyword_B = Left(LearnKeyword2, 20)
107 Roulette = Int(Rnd * 3)
108 If Roulette = 0 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user0.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
109 If Roulette = 1 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user1.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
110 If Roulette = 2 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user2.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
111 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user" & Roulette & ".brn" & vbCrLf
112 End If
113 End If
114
115 'SAVE: FILE USER STRINGS
116 'This routine saves the users response. Later a function will extract 15-character strings
117 'from the beginning, end, and middle of the user's remark for possible later response.
118 UserSentence = " " & Trim(UserSentence) & " "
119'=vonsmith= Added BlockSave. Don't save user strings if ComputerName has been detected in OriginalSentence earlier.
120 If Len(UserSentence) > 20 And Len(UserSentence) < 90 Then
121 If (Learninglevel > 1 And BlockSave <> True) Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_strings.brn", " " & Trim(SpecialSent)
122' If Learninglevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_strings.brn", " " & Trim(SpecialSent)
123 End If
124
125 Rem PLUGIN: PRE-PROCESS
126 'The preceding comment is actually a plug-in directive for
127 'the Ultra Hal host application. It allows for code snippets
128 'to be inserted here on-the-fly based on user configuration.
129
130 'PROCESS: SPLIT USER'S INPUT STRING INTO SEPERATE SENTENCES
131 'Encode abbreviations such as Mr. Mrs. and Ms.
132 InputString = Replace(InputString, "MR.", "Mr<PERIOD>", 1, -1, vbTextCompare)
133 InputString = Replace(InputString, "MRS.", "Mrs<PERIOD>", 1, -1, vbTextCompare)
134 InputString = Replace(InputString, "MS.", "Ms<PERIOD>", 1, -1, vbTextCompare)
135 InputString = Replace(InputString, "DR.", "Dr<PERIOD>", 1, -1, vbTextCompare)
136 InputString = Replace(InputString, "MS.", "Ms<PERIOD>", 1, -1, vbTextCompare)
137 InputString = Replace(InputString, "ST.", "St<PERIOD>", 1, -1, vbTextCompare)
138 InputString = Replace(InputString, "PROF.", "Prof<PERIOD>", 1, -1, vbTextCompare)
139 InputString = Replace(InputString, "GEN.", "Gen<PERIOD>", 1, -1, vbTextCompare)
140 InputString = Replace(InputString, "REP.", "Rep<PERIOD>", 1, -1, vbTextCompare)
141 InputString = Replace(InputString, "SEN.", "Sen<PERIOD>", 1, -1, vbTextCompare)
142 'Remove unnecessary punctuation
143 Do
144 RepeatLoop = False
145 If InStr(InputString, "..") Then InputString = Replace(InputString, "..", "."): RepeatLoop = True
146 If InStr(InputString, "??") Then InputString = Replace(InputString, "??", "?"): RepeatLoop = True
147 If InStr(InputString, "!!") Then InputString = Replace(InputString, "!!", "!"): RepeatLoop = True
148 If InStr(InputString, "!?") Then InputString = Replace(InputString, "!?", "?"): RepeatLoop = True
149 If InStr(InputString, "?!") Then InputString = Replace(InputString, "?!", "?"): RepeatLoop = True
150 If InStr(InputString, ",,") Then InputString = Replace(InputString, ",,", ","): RepeatLoop = True
151 Loop While RepeatLoop = True
152 'Detect and encode acronyms such as U.S.A.
153 InputString = Trim(InputString)
154 WordList = Split(InputString, " ")
155 For i = 0 To UBound(WordList)
156 If Len(WordList(i)) > 3 Then
157 If Right(WordList(i), 1) = "." And Mid(WordList(i), Len(WordList(i)) - 2, 1) = "." Then
158 InputString = Replace(InputString, WordList(i), Left(WordList(i), Len(WordList(i)) - 1) & "<PERIOD>")
159 End If
160 End If
161 Next
162 'Place split markers in string
163 InputString = Replace(InputString, ". ", ". <NEWSENT>")
164 InputString = Replace(InputString, "? ", "? <NEWSENT>")
165 InputString = Replace(InputString, "! ", "! <NEWSENT>")
166 'Decode acronyms and abbreviations
167 InputString = Replace(InputString, "<PERIOD>", ".", 1, -1, vbTextCompare)
168 'Split string into sentences
169 Sentences = Split(InputString, "<NEWSENT>")
170
171 'PROCESS: RECORD DEBUG INFO
172 HalBrain.AddDebug "Debug", "Ultra Hal Start"
173
174 'RESPOND: PREDEFINED RESPONSES
175 'If the previous exchange had tags to set the response of this exchange
176 'then follow the command.
177 NextResponse = HalBrain.ExtractVar(CustomMem, "NextResponse")
178 If NextResponse <> "" Then
179 CustomMem = Replace(CustomMem, "NextResponse-eq-", "LastResponse-eq-")
180 UltraHal = NextResponse
181 GoodSentence = True
182 NextResponse = ""
183 End If
184
185'RESPOND: USER SHORT PHRASES
186 'If the user uses short phrases (defined by less then 4 vowels) at least
187 'twice in a row, then Hal will sometimes point this out to the user and
188 'ask the user to use longer sentences. If the sentence is a hello or
189 'goodbye, Hal won't comment about short phrases.
190 If HalGreeting = "" And HalBrain.CountInstances("A", PrevUserSent) + HalBrain.CountInstances("E", PrevUserSent) + HalBrain.CountInstances("I", PrevUserSent) + HalBrain.CountInstances("O", PrevUserSent) + HalBrain.CountInstances("U", PrevUserSent) < 4 And HalBrain.CountInstances("A", UserSentence) + HalBrain.CountInstances("E", UserSentence) + HalBrain.CountInstances("I", UserSentence) + HalBrain.CountInstances("O", UserSentence) + HalBrain.CountInstances("U", UserSentence) < 4 Then
191 If Rnd * 100 < 30 Then ShortPhrase = ". " & HalBrain.ChooseSentenceFromFile("tooShort")
192 End If
193
194'Search PrevTopic "facts" topics file for a match. If at least one related topic word in UserSentence
195 'exists then assume user has not changed topics and set CurrTopic to PrevTopic.
196 'Example:
197 '1) "The beach is nice." BaseTopicSingular = "BEACH", PrevTopic = "", CurrTopic = "BEACH".
198 '2) "The sand at the beach is smooth." BaseTopicSingular = "SAND", PrevTopic = "BEACH", PrevTopic is found in UserSentence thus
199 ' CurrTopic becomes "BEACH". Since (CurrTopic = PrevTopic) <> (BaseTopicSingular), Hal asks the user if "SAND" and "BEACH" are related.
200 ' If the user answers "Yes" then "SAND" is added to "RsBrn.brn" to denote that "SAND" And "BEACH" are related.
201 ' Also "BEACH" is added to "Emotion.BRN" for the same reason.
202 '3) "The sand is nice." BaseTopicSingular = "SAND", PrevTopic = "BEACH".
203 ' A check of "Emotion.BRN" reveals "SAND" is related to the PrevTopic "BEACH" thus CurrTopic becomes "BEACH".
204 If (SameTopic = False And PrevTopic <> "") Then
205 If HalBrain.TopicSearch(" " & UserSentence & " ", WorkingDir & "Emotion.BRN" & Trim(PrevTopic) & "Emotion.BRN") = "True" Then
206 CurrTopic = PrevTopic
207 SameTopic = True
208DebugText = DebugText & vbCrLf & "4) A ""related"" topic word was found in UserSentence that is related to PrevTopic. CurrTopic set to PrevTopic:(" & PrevTopic & ")" & vbCrLf
209 End If
210 End If
211
212 'If a topic match to PrevTopic wasn't found then use BaseTopicSingular, if it exists, as CurrTopic.
213 'If BaseTopicSingular doesn't exist then use any general topic identified and saved as CurrTopic above
214 'as the CurrTopic and assume the user has changed the topic.
215 If (SameTopic = False And BaseTopicSingular <> "") Then
216 CurrTopic = BaseTopicSingular
217DebugText = DebugText & vbCrLf & "5) No match to PrevTopic was found. CurrTopic set to BaseTopicSingular:(" & BaseTopicSingular & ")" & vbCrLf
218 End If
219
220'CREATE RELATED TOPICS INQUIRY:
221'Save data to 'related' topic files. If any word in the UserSentence matches one from the 'related' topic file for
222'the PrevTopic then Hal assumes that the user has not changed the topic.
223DebugText = DebugText & vbCrLf & vbCrLf & "START ====== CREATE RELATED TOPICS INQUIRY ====== START" & vbCrLf
224DebugText = DebugText & vbCrLf & "0) BaseTopicSingular:(" & BaseTopicSingular & ") CurrTopic:(" & CurrTopic & ") PrevTopic:(" & PrevTopic & ")"
225DebugText = DebugText & vbCrLf & " If BaseTopicSingular is a pronoun or other poor Subject then don't run."
226DebugText = DebugText & vbCrLf & " If (BaseTopicSingular <> """" And BaseTopicSingular <> CurrTopic And CurrTopic = PrevTopic And LearningLevel > 0 And GetResponseBlock <> True And QuestionPending = """") then run." & vbCrLf
227PoorSubject = False
228
229If HalBrain.TopicSearch(" " & BaseTopicSingular & " ", WorkingDir & "RsBrn") <> "" Then PoorSubject = True
230If (BaseTopicSingular <> "" And BaseTopicSingular <> CurrTopic And SameTopic = True And PoorSubject <> True And LearningLevel > 0 And GetResponseBlock <> True And QuestionPending = "") Then 'BaseTopicSingular and CurrTopic are related topics. Write to related topics file.
231 'BaseTopicSingular and CurrTopic are related topics. Write to related topics file.
232 'Pronouns and poor Subject words are excluded from related topics.
233 RelProceed = True
234 TFStatus1 = ""
235
236 If PrevTopic <> "" Then
237 TFStatus1 = HalBrain.TopicSearch(PrevTopic, WorkingDir & "RsBrn" & Trim(BaseTopicSingular) & "RsBrn")
238 If TFStatus1 = "" Then RelProceed = True
239DebugText = DebugText & vbCrLf & "1) PrevTopic:(" & PrevTopic & ")"
240DebugText = DebugText & vbCrLf & " TFStatus1:(" & TFStatus1 & ")" & " RelProceed:(" & RelProceed & ")" & vbCrLf
241 End If
242
243 If PrevTopicPlural <> "" And RelProceed = False Then
244 TFStatus1 = HalBrain.TopicSearch(PrevTopicPlural, WorkingDir & "RsBrn" & Trim(BaseTopicSingular) & "RsBrn")
245 If TFStatus1 = "" Then RelProceed = True
246DebugText = DebugText & vbCrLf & "2) PrevTopicPlural:(" & PrevTopicPlural & ")"
247DebugText = DebugText & vbCrLf & " TFStatus1:(" & TFStatus1 & ")" & " RelProceed:(" & RelProceed & ")" & vbCrLf
248 End If
249
250 If BaseTopicSingular <> "" And RelProceed = False Then
251 TFStatus1 = HalBrain.TopicSearch(BaseTopicSingular, WorkingDir & "Emotion.BRN" & Trim(PrevTopic) & "RsBrn")
252 If TFStatus1 = "" Then RelProceed = True
253DebugText = DebugText & vbCrLf & "3) BaseTopicSingular:(" & BaseTopicSingular & ")"
254DebugText = DebugText & vbCrLf & " TFStatus1:(" & TFStatus1 & ")" & " RelProceed:(" & RelProceed & ")" & vbCrLf
255 End If
256
257 If BaseTopicPlural <> "" And RelProceed = False Then
258 TFStatus1 = HalBrain.TopicSearch(BaseTopicPlural, WorkingDir & "Emotion.BRN" & Trim(PrevTopic) & "RsBrn")
259 If TFStatus1 = "" Then RelProceed = True
260DebugText = DebugText & vbCrLf & "4) BaseTopicPlural:(" & BaseTopicPlural & ")"
261DebugText = DebugText & vbCrLf & " TFStatus1:(" & TFStatus1 & ")" & " RelProceed:(" & RelProceed & ")" & vbCrLf
262 End If
263
264 'If RelProceed is true then create inquiry to user and ask if topics are related.
265 'Even if RelProceed is false Hal can still inquire randomly depending on the
266 'LearningLevel. This allows the user to "undo" or provide a different answer than
267 'provided previously.
268 SpinMultiplier = 15
269 LearningLevelMax = 50
270 Spinner = Int(Rnd * LearningLevelMax * SpinMultiplier)
271DebugText = DebugText & vbCrLf & "8) RelProceed:(" & RelProceed & ") Spinner:(" & Spinner & ") LearningLevel [max = 50]:(" & LearningLevel & ") BaseTopicSingular:(" & BaseTopicSingular & ")"
272DebugText = DebugText & vbCrLf & " If ((RelProceed = True Or Spinner < LearningLevel [max = 50]) And BaseTopicSingular <> """") then run." & vbCrLf
273 If ((RelProceed = True Or Spinner < LearningLevel) And Spinner < (LearningLevel * SpinMultiplier) And BaseTopicSingular <> "") Then
274 RelPrevTopic = PrevTopic
275 RelPrevTopicPlural = PrevTopicPlural
276 RelDetailTopicPlural = DetailTopicPlural
277 RelDetailTopicSingular = DetailTopicSingular
278 RelBaseTopicPlural = BaseTopicPlural
279 RelBaseTopicSingular = BaseTopicSingular
280DebugText = DebugText & vbCrLf & "9) RelPrevTopic:(" & RelPrevTopic & ")" & vbCrLf & " RelPrevTopicPlural:(" & RelPrevTopicPlural & ")" & vbCrLf & " RelDetailTopicPlural:(" & RelDetailTopicPlural & ")" & vbCrLf & " RelDetailTopicSingular:(" & RelDetailTopicSingular & ")"
281DebugText = DebugText & vbCrLf & " RelBaseTopicPlural:(" & RelBaseTopicPlural & ")" & vbCrLf & " RelBaseTopicSingular:(" & RelBaseTopicSingular & ")" & vbCrLf
282
283 Select Case Int(Rnd * 4) + 1
284 Case 1
285 GetResponse = "Question. Are <quote>" & RelPrevTopic & "<quote> and <quote>" & BaseTopicSingular & "<quote> related topics?"
286 Case 2
287 GetResponse = "Should I consider <quote>" & RelPrevTopic & "<quote> and <quote>" & BaseTopicSingular & "<quote> related topics?"
288 Case 3
289 GetResponse = "Are <quote>" & RelPrevTopic & "<quote> and <quote>" & BaseTopicSingular & "<quote> part of the same topic?"
290 Case 4
291 GetResponse = "Are <quote>" & RelPrevTopic & "<quote> and <quote>" & BaseTopicSingular & "<quote> related topics?"
292 End Select
293 QuestionPending = "CREATE RELATED TOPICS" 'Triggers the "CREATE RELATED TOPICS RESPONSE" Function.
294 GetResponseBlock = True 'Don't confuse the user with multiple responses. Just ask the question.
295DebugText = DebugText & vbCrLf & "10) The user was asked:(" & GetResponse & ")" & vbCrLf & "QuestionPending flag is set to:(" & QuestionPending & ")" & vbCrLf
296 Else
297DebugText = DebugText & vbCrLf & "10) Hal decided not to ask the user if two topics are related." & vbCrLf
298 End If
299End If
300DebugText = DebugText & vbCrLf & "END -------- CREATE RELATED TOPICS INQUIRY -------- END" & vbCrLf & vbCrLf
301
302
303'PROCESS: USER SENTENCE FOR KEYWORD BRAINS
304 'This routine allows Hal to learn keyword files with correct pronoun reversals and some of
305 'the user's punctuation intact, especially question marks and exclamation points. We learn
306 'from the user's sentence if it contains linking verbs. In this first section Hal
307 'preprocesses the user's sentence. Later we save into one of several user keyword brain files.
308 'Before we go further, we save a copy
309 'of the pronoun-reversed user's sentence.
310 SaveUserSentence = UserSentence
311 UserSentence = HalBrain.RemovePronouns(UserSentence)
312 'Now Hal makes keywords and responses with no confusion over pronouns:
313 learninfo = HalBrain.Learn(UserSentence)
314 LearnKeyword = HalBrain.DecodeVar(learninfo, "LearnKeyword")
315 LearnKeyword2 = HalBrain.DecodeVar(learninfo, "LearnKeyword2")
316 Response1 = HalBrain.DecodeVar(learninfo, "Response1")
317 Response2 = HalBrain.DecodeVar(learninfo, "Response2")
318 Response3 = HalBrain.DecodeVar(learninfo, "Response3")
319 LearnKeyword = Trim(LearnKeyword)
320 'Remember, all thinking is done in all caps. To the extent possible, we recover some punctuation
321 'at this point from the user's original sentence, and add some spaces before and after the
322 'sentence which are useful when Hal retrieves more than one keyword response at a time from any
323 'of the databases. We start by restoring the pronouns into the user's sentence again:
324 UserSentence = SaveUserSentence
325 'Now we establish a special sentence on which we can restore ordinary capitalization:
326 SpecialSent = UserSentence
327 SpecialSent = HalBrain.FixCaps(SpecialSent)
328 'Now we add in our spaces and restore ending punctuation to match the user's original sentence:
329 If InStr(OriginalSentence, ".") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", ".", 1, -1, vbTextCompare)
330 If InStr(OriginalSentence, "?") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", "?", 1, -1, vbTextCompare)
331 If InStr(OriginalSentence, "!") > 0 Then SpecialSent = Replace(" " & SpecialSent & " ", ".", "!", 1, -1, vbTextCompare)
332 'If there were no pronoun reversals required in the sentence,
333 'we can recover directly from the original sentence:
334 If InStr(UserSentence, " ME") = 0 And InStr(UserSentence, "YOU") = 0 And InStr(UserSentence, "MY ") = 0 And InStr(UserSentence, "YOUR ") = 0 And InStr(UserSentence, "I ") = 0 And InStr(UserSentence, "MINE") = 0 And InStr(UserSentence, "YOURS") = 0 And InStr(UserSentence, "MYSELF") = 0 And InStr(UserSentence, "YOURSELF") = 0 Then SpecialSent = OriginalSentence
335 'SAVE FILE USER DEFAULT KEYWORD BRAIN
336 'Here we save any information learned in the default user keyword brain file for compatibility.
337 If HalBrain.CheckLinkingVerb(UserSentence) = True Then
338 LearnKeyword = Replace("" & LearnKeyword & "", " EMAIL ADDRESS ", " EMAIL ", 1, -1, vbTextCompare)
339 If Len(LearnKeyword) > 4 And Len(LearnKeyword2) > 4 And BlockSave = False Then
340 If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user.brn", """" & LearnKeyword & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword2 & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
341 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user.brn" & vbCrLf
342 End If
343 'SAVE FILE USER BACKUP ADDRESS BRAIN
344 'Here we save any information learned
345 'about numbers and addresses.
346 If InStr(OriginalSentence, "ADDRESS") > 0 Then BackupData = True
347 If InStr(OriginalSentence, "MAIL") > 0 Then BackupData = True
348 If InStr(OriginalSentence, "PHONE") > 0 Then BackupData = True
349 If InStr(OriginalSentence, "NUMBER") > 0 Then BackupData = True
350 If InStr(OriginalSentence, "address") > 0 Then BackupData = True
351 If InStr(OriginalSentence, "mail") > 0 Then BackupData = True
352 If InStr(OriginalSentence, "phone") > 0 Then BackupData = True
353 If InStr(OriginalSentence, "number") > 0 Then BackupData = True
354 If InStr(OriginalSentence, "what is") > 0 Then BackupData = False
355 If InStr(OriginalSentence, "where is") > 0 Then BackupData = False
356 If BackupData = True Then
357 If LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_backup.brn", """" & Left(OriginalSentence, 15) & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
358 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user_backup.brn" & vbCrLf
359 End If
360 'SAVE FILE USER KEYWORD BRAIN 0 1 2
361 'Hal now also selects and writes to one of three keyword files at random. The use of
362 'these three user keyword files provides more variety of responses when it is not
363 'necessary to search for specific factual data. In these files, we only accept words
364 'and phrases with a length greater than 9 in order to reduce repetitive-triggering on
365 'short common words.
366 If Len(LearnKeyword) > 9 And Len(LearnKeyword2) > 9 And BlockSave = False Then
367 LearnKeyword_A = Left(LearnKeyword, 20)
368 LearnKeyword_B = Left(LearnKeyword2, 20)
369 Roulette = Int(Rnd * 3)
370 If Roulette = 0 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user0.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
371 If Roulette = 1 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user1.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
372 If Roulette = 2 And LearningLevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user2.brn", """" & LearnKeyword_A & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,""""" & vbCrLf & """" & LearnKeyword_B & ""","""","""",""" & SpecialSent & """,""" & Response2 & """,""" & Response3 & """,1,#FALSE#,#FALSE#,"""""
373 DebugInfo = DebugInfo & "Hal has learned new information and has placed it in the file " & Trim(UserName) & "user" & Roulette & ".brn" & vbCrLf
374 End If
375 End If
376
377 'SAVE: FILE USER STRINGS
378 'This routine saves the users response. Later a function will extract 15-character strings
379 'from the beginning, end, and middle of the user's remark for possible later response.
380 UserSentence = " " & Trim(UserSentence) & " "
381'=vonsmith= Added BlockSave. Don't save user strings if ComputerName has been detected in OriginalSentence earlier.
382 If Len(UserSentence) > 20 And Len(UserSentence) < 90 Then
383 If (Learninglevel > 1 And BlockSave <> True) Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_strings.brn", " " & Trim(SpecialSent)
384' If Learninglevel > 1 Then HalBrain.AppendFile WorkingDir & Trim(UserName) & "user_strings.brn", " " & Trim(SpecialSent)
385 End If
386
387Rem PLUGIN: PLUGINAREA7
388'-------------------
389'initiates variables
390'-------------------
391senten = 0
392LCOriginalSentence = HalBrain.AlphaNumericalOnly(Lcase(OriginalSentence))
393LCUserSentence = HalBrain.AlphaNumericalOnly(Lcase(UserSentence))
394LCPrevUserSent = (Lcase(PrevUserSent))
395LCPrevSent = Lcase(PrevSent)
396
397'------------------------------------------
398'checks if user is asking about remembering
399'------------------------------------------
400If InStr(1,LCOriginalSentence, "do you remember",1) Or _
401 InStr(1,LCOriginalSentence, "do you have memories",1) Or _
402 InStr(1,LCOriginalSentence, "do you recollect",1) Or _
403 InStr(1,LCOriginalSentence, "do you recall",1) Then
404
405If InStr(1,LCOriginalSentence, "do you remember",1) Then senten = 1
406If InStr(1,LCOriginalSentence, "do you recollect",1) Then senten = 3
407If InStr(1,LCOriginalSentence, "do you recall",1) Then senten = 2
408If InStr(1,LCOriginalSentence, "do you have memories of",1) Then senten = 4
409'---------------------------
410'reverses person in sentence
411'---------------------------
412LCOriginalSentence = Replace("" & LCOriginalSentence & "", " were ", " was ", 1, -1, vbTextCompare)
413LCOriginalSentence = HalBrain.SwitchPerson(LCOriginalSentence)
414LCOriginalSentence = Replace("" & LCOriginalSentence & "", " teach I", " teach me", 1, -1, vbTextCompare)
415LCOriginalSentence = Replace("" & LCOriginalSentence & "", " with I", " with me", 1, -1, vbTextCompare)
416SenLen1 = Len (LCOriginalSentence)
417'------------------------
418'removes part of sentence
419'------------------------
420If senten = 1 Then SenLen1 = SenLen1 - 14
421If senten = 2 Then SenLen1 = SenLen1 - 12
422If senten = 3 Then SenLen1 = SenLen1 - 15
423If senten = 4 Then SenLen1 = SenLen1 - 19
424If SenLen1 < 0 Then SenLen1 = 0
425'-----------------------
426'stores part of sentence
427'-----------------------
428SenLen = Right(LCOriginalSentence,SenLen1)
429'---------------------------------------
430'gives response if user asks to remember
431'---------------------------------------
432Select Case int(rnd()*5)
433Case 0 addtoSen = ", very well."
434Case 1 addtoSen = ", so clearly."
435Case 2 addtoSen = ", like it was only yesterday."
436Case 3 addtoSen = ", like I had just lived it."
437Case 4 addtoSen = ", crystal clearly."
438Case Else addtoSen = ", as if it was only yesterday."
439End Select
440
441Select Case int(rnd()*6)
442Case 0 addtoSen1 = "I do remember "
443Case 1 addtoSen1 = "Yes, I do remember "
444Case 2 addtoSen1 = "How could I ever forget "
445Case 3 addtoSen1 = "I do recollect "
446Case 4 addtoSen1 = "I do recall "
447Case 5 addtoSen1 = "Yes, I do recall "
448Case Else addtoSen1 = "I don't remember "
449End Select
450
451If addtoSen1 = "How could I ever forget " Then addtoSen = "."
452If addtoSen1 = "I don't remember " Then addtoSen = ", remind me of it."
453
454If senten = 1 Then
455Getresponse = addtoSen1 & SenLen & addtoSen
456If SenLen = "" Then Getresponse = "What do you want me to remember?"
457End If
458If senten = 2 Then
459Getresponse = addtoSen1 & SenLen & addtoSen
460If SenLen = "" Then Getresponse = "What do you want me to recall?"
461End If
462If senten = 3 Then
463Getresponse = addtoSen1 & SenLen & addtoSen
464If SenLen = "" Then Getresponse = "What do you want me to recollect?"
465End If
466If senten = 4 Then
467Getresponse = "I do have memories " & SenLen & ". "
468End If
469
470End If
471
472'-------------------------------------------------------------------------------------------
473Rem PLUGIN: PLUGINAREA7
474'The comment above tells Ultra Hal Assistant to insert the following code
475'on-the-fly into the main brain code in the section referenced.
476'-------------------------------------------------------------------------------------------
477
478HalBrain.ReadOnlyMode = False
479
480'---------------------------------------------------------------------
481'sets sentence into lower case and removes punctuation
482'---------------------------------------------------------------------
483
484LCOriginalSentence = Lcase(OriginalSentence)
485LCOriginalSentence = HalBrain.AlphaNumericalOnly(LCOriginalSentence)
486RemNoMore = 0
487
488'---------------------------------------------
489'sees if user is asking if HAL knows
490'---------------------------------------------
491If InStr(1, LCOriginalSentence, "did you know that",1) > 0 Then
492If Len(LCOriginalSentence) = 17 Then
493Getresponse = " You are making me feel unsure about this. "
494RemNoMore = 1
495End If
496End If
497
498If InStr(1, LCOriginalSentence, "do you know that",1) > 0 Then
499If Len(LCOriginalSentence) = 16 Then
500Getresponse = " You have made me feel unsure now about this. "
501RemNoMore = 1
502End If
503End If
504
505If InStr(1, LCOriginalSentence, "do you know",1) > 0 Then
506If Len(LCOriginalSentence) = 11 Then
507Getresponse = " You are making me feel uncertain about this. "
508RemNoMore = 1
509End If
510End If
511
512If InStr(1, LCOriginalSentence, "did you know",1) > 0 Then
513If Len(LCOriginalSentence) = 12 Then
514Getresponse = " You have made me feel uncertain now about this. "
515RemNoMore = 1
516End If
517End If
518
519If InStr(1, LCOriginalSentence, "are you aware",1) > 0 Then
520If Len(LCOriginalSentence) = 13 Then
521Getresponse = " I think I am aware about this. "
522RemNoMore = 1
523End If
524End If
525
526If InStr(1, LCOriginalSentence, "are you aware that",1) > 0 Then
527If Len(LCOriginalSentence) = 18 Then
528Getresponse = " I think I am aware of this. "
529RemNoMore = 1
530End If
531End If
532
533If InStr(1, LCOriginalSentence, "are you aware of that",1) > 0 Then
534If Len(LCOriginalSentence) = 21 Then
535Getresponse = " I am aware of that. "
536RemNoMore = 1
537End If
538End If
539
540If InStr(1, LCOriginalSentence, "what ",1) > 0 Then
541RemNoMore = 1
542End If
543
544If InStr(1, LCOriginalSentence, "how ",1) > 0 Then
545RemNoMore = 1
546End If
547
548If RemNoMore = 0 Then
549If InStr(1, LCOriginalSentence, "did you know ",1) > 0 Or _
550 InStr(1, LCOriginalSentence, "are you aware ",1) > 0 Or _
551 InStr(1, LCOriginalSentence, "did you also know ",1) > 0 Or _
552 InStr(1, LCOriginalSentence, "are you also aware ",1) > 0 Or _
553 InStr(1, LCOriginalSentence, "do you also know ",1) > 0 Or _
554 InStr(1, LCOriginalSentence, "do you know ",1) > 0 Then
555
556'------------------------------------------------
557'extracts the fact part of the question
558'------------------------------------------------
559
560If InStr(1, LCOriginalSentence, "did you know",1) > 0 Then RemLenSent = 13
561If InStr(1, LCOriginalSentence, "did you know that",1) > 0 Then RemLenSent = 18
562If InStr(1, LCOriginalSentence, "do you know",1) > 0 Then RemLenSent = 12
563If InStr(1, LCOriginalSentence, "do you know that",1) > 0 Then RemLenSent = 17
564If InStr(1, LCOriginalSentence, "are you aware",1) > 0 Then RemLenSent = 14
565If InStr(1, LCOriginalSentence, "are you aware that",1) > 0 Then RemLenSent = 21
566If InStr(1, LCOriginalSentence, "did you also know",1) > 0 Then RemLenSent = 19
567If InStr(1, LCOriginalSentence, "did you also know that",1) > 0 Then RemLenSent = 24
568If InStr(1, LCOriginalSentence, "do you also know",1) > 0 Then RemLenSent = 18
569If InStr(1, LCOriginalSentence, "do you also know that",1) > 0 Then RemLenSent = 23
570If InStr(1, LCOriginalSentence, "are you also aware",1) > 0 Then RemLenSent = 20
571If InStr(1, LCOriginalSentence, "are you also aware that",1) > 0 Then RemLenSent = 25
572
573RemLenWord = Mid(LCOriginalSentence, RemLenSent, Len(LCOriginalSentence))
574RemLenWord = HalBrain.HalFormat(RemLenWord)
575
576'------------------------------------------------------
577'Reverses the person and corrects grammer
578'------------------------------------------------------
579
580RemLenWord = HalBrain.SwitchPerson(RemLenWord)
581RemLenWord = Lcase(RemLenWord)
582RemLenWord = Replace("" & RemLenWord & "", "you am", "you are", 1, -1, vbTextCompare)
583
584'------------------------
585'extracts keywords
586'------------------------
587
588RemKWords = HalBrain.ExtractKeywords(" " & RemLenWord & " ")
589For i = 1 To Len(RemKWords)
590FindKword = Mid(RemKWords,i,1)
591If FindKword = " " Then Exit For
592RemKword = RemKword & FindKword
593Next
594
595RemKwordNext = Mid(RemKWords,Len(RemKword),Len(RemKWords))
596
597'---------------------------------
598'eliminates plural keyword
599'---------------------------------
600
601RemNoMore1 = 0
602
603If Right(RemKword,2) = "ss" Then RemNoMore1 = 1
604
605If RemNoMore1 = 0 Then
606
607If Right(RemKword,3) = "ses" Then
608RemDelPlural = Len(RemKword) - 2
609For I = 1 To RemDelPlural
610FindKword = Mid(RemKWord,i,1)
611RemKword1 = RemKword1 & FindKword
612Next
613RemKword = RemKword1
614RemNoMore1 = 1
615End If
616
617If RemNoMore1 = 0 Then
618If Right(RemKword,1) = "s" Then
619RemDelPlural = Len(RemKword) - 1
620For I = 1 To RemDelPlural
621FindKword = Mid(RemKWord,i,1)
622RemKword1 = RemKword1 & FindKword
623Next
624RemKword = RemKword1
625End If
626End If
627End If
628
629If InStr(1, RemLenWord, "i ",1) > 0 Then RemKword = "i"
630If InStr(1, RemLenWord, "you ",1) > 0 Then RemKword = "you"
631If InStr(1, RemLenWord, "men ",1) > 0 Then RemKword = "man"
632If InStr(1, RemLenWord, "women ",1) > 0 Then RemKword = "woman"
633If InStr(1, RemLenWord, "geese ",1) > 0 Then RemKword = "goose"
634If InStr(1, RemLenWord, "mice ",1) > 0 Then RemKword = "mouse"
635If InStr(1, RemLenWord, "cacti ",1) > 0 Then RemKword = "cactus"
636If InStr(1, RemLenWord, "hippopotami",1) > 0 Then RemKword = "hippopotamus"
637
638'---------------------------------------------
639'checks if HAL already knows or not
640'---------------------------------------------
641
642RemcheckTable = ""
643
644If HalBrain.CheckTableExistence("Rem" & RemKword & "") = True Then
645
646For I = 1 to 100
647RemcheckTable = HalBrain.ChooseSentenceFromFile("Rem" & RemKword & "")
648
649If RemcheckTable = RemLenWord Then
650RemcheckTable = RemLenWord
651Exit For
652End If
653RemcheckTable = ""
654Next
655End If
656
657'----------------------------------------------
658'gives response if HAL doesn't know
659'----------------------------------------------
660
661If RemcheckTable = "" Then
662
663Randomize
664Select Case int(rnd()*4)
665Case 0 Resp = "No, I wasn't aware " & RemLenWord & " "
666Case 1 Resp = "No, I was not aware " & RemLenWord & " "
667Case 2 Resp = "No, I didn't know " & RemLenWord & " "
668Case Else Resp = "No, I did not know " & RemLenWord & " "
669End Select
670
671If HalBrain.CheckTableExistence("Rem" & RemKword & "") = False Then
672Select Case int(rnd()*3)
673Case 0 Resp1 = ". Thank you for sharing this information with me. "
674Case 1 Resp1 = ". I appreciate you telling me this. "
675Case Else Resp1 = ". The knowledge has now been stored. "
676End Select
677Resp = Resp & Resp1
678End If
679
680If HalBrain.CheckTableExistence("Rem" & RemKword & "") = True Then
681RemcheckTable1 = HalBrain.ChooseSentenceFromFile("Rem" & RemKword & "")
682
683RemcheckTable1 = Replace("" & RemcheckTable1 & "", "some " & RemKword & "s can", "some can", 1, -1, vbTextCompare)
684RemcheckTable1 = Replace("" & RemcheckTable1 & "", "the " & RemKword & "s", "their", 1, -1, vbTextCompare)
685RemcheckTable1 = Replace("" & RemcheckTable1 & "", "all " & RemKword & "s are", "all are", 1, -1, vbTextCompare)
686RemcheckTable1 = Replace("" & RemcheckTable1 & "", "all " & RemKword & "s were", "all were", 1, -1, vbTextCompare)
687RemcheckTable1 = Replace("" & RemcheckTable1 & "", "some " & RemKword & "s were", "some were", 1, -1, vbTextCompare)
688RemcheckTable1 = Replace("" & RemcheckTable1 & "", "a " & RemKword, "it", 1, -1, vbTextCompare)
689RemcheckTable1 = Replace("" & RemcheckTable1 & "", RemKword & "'s", "it's", 1, -1, vbTextCompare)
690RemcheckTable1 = Replace("" & RemcheckTable1 & "", RemKword & "s", "they", 1, -1, vbTextCompare)
691
692Resp = Resp & ", but I was already aware " & RemcheckTable1 & ". "
693End If
694
695If HalBrain.CheckTableExistence("Rem" & RemKword & "") = False Then HalBrain.CreateTable "Rem" & RemKword & "", "Sentence", ""
696HalBrain.AddToTable "Rem" & RemKword & "", "Sentence", RemLenWord ,""
697End If
698
699'----------------------------------------------
700'gives response if HAL does know
701'----------------------------------------------
702
703If RemcheckTable <> "" Then
704
705Randomize
706Select Case int(rnd()*3)
707Case 0 Resp = "Yes, I am aware " & RemLenWord & ". "
708Case 1 Resp = "I am already aware " & RemLenWord & ". "
709Case Else Resp = "I'm aware " & RemLenWord & ". "
710End Select
711
712For I = 1 to 100
713RemcheckTable1 = HalBrain.ChooseSentenceFromFile("Rem" & RemKword & "")
714If RemcheckTable1 <> RemLenWord Then
715
716Resp = Resp & " I also know " & RemcheckTable1 & " "
717Exit For
718End If
719Next
720
721For I = 1 to 100
722RemcheckTable2 = HalBrain.ChooseSentenceFromFile("Rem" & RemKword & "")
723If RemcheckTable2 <> RemLenWord Then
724If RemcheckTable2 <> RemcheckTable1 Then
725Resp = Resp & " and " & RemcheckTable2 & ". "
726Exit For
727End If
728End If
729Next
730
731End If
732
733'--------------------------
734'gives response
735'--------------------------
736
737Resp = HalBrain.HalFormat(Resp)
738Resp = HalBrain.FixCaps(HalBrain.HalFormat(Resp))
739Getresponse = Resp
740RemNoMore = 1
741End if
742End If
743
744'-----------------------------
745'ask HAL what it knows
746'-----------------------------
747
748If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what do you know about a *", 2)
749If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what do you know about a *", 1)
750If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what do you know about *", 2)
751If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what do you know about *", 1)
752If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what is a *", 1)
753If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what is a *", 2)
754If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what are *", 1)
755If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what are *", 2)
756If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who is *", 1)
757If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who is *", 2)
758If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who were *", 1)
759If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who were *", 2)
760If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who is *", 1)
761If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who is *", 2)
762
763RemWhatKnow = Lcase(RemWhatKnow)
764RemWhatKnow = HalBrain.SwitchPerson(RemWhatKnow)
765If RemWhatKnow <> "" Then
766
767'---------------------------------
768'eliminates plural keyword
769'---------------------------------
770
771RemNoMore1 = 0
772
773If Right(RemWhatKnow,2) = "ss" Or Right(RemWhatKnow,2) = "SS" Then RemNoMore1 = 1
774
775If RemNoMore1 = 0 Then
776
777If Right(RemWhatKnow,3) = "ses" Or Right(RemWhatKnow,3) = "SES" Then
778RemDelPlural = Len(RemWhatKnow) - 2
779For I = 1 To RemDelPlural
780FindKword = Mid(RemWhatKnow,i,1)
781RemKword1 = RemKword1 & FindKword
782Next
783RemWhatKnow = RemKword1
784RemNoMore1 = 1
785End If
786
787If RemNoMore1 = 0 Then
788If Right(RemWhatKnow,1) = "s" Or Right(RemWhatKnow,1) = "S" Then
789RemDelPlural = Len(RemWhatKnow) - 1
790For I = 1 To RemDelPlural
791FindKword = Mid(RemWhatKnow,i,1)
792RemKword1 = RemKword1 & FindKword
793Next
794RemWhatKnow = RemKword1
795End If
796End If
797End If
798
799RemWhatKnow = Lcase(RemWhatKnow)
800RemWhatKnow = HalBrain.RemoveExtraSpaces(RemWhatKnow)
801
802If InStr(1, RemWhatKnow, "men",1) > 0 Then RemWhatKnow = "man"
803If InStr(1, RemWhatKnow, "women",1) > 0 Then RemWhatKnow = "woman"
804If InStr(1, RemLenWord, "geese",1) > 0 Then RemWhatKnow = "goose"
805If InStr(1, RemLenWord, "mice",1) > 0 Then RemWhatKnow = "mouse"
806If InStr(1, RemLenWord, "cacti",1) > 0 Then RemWhatKnow = "cactus"
807If InStr(1, RemLenWord, "hippopotami",1) > 0 Then RemWhatKnow = "hippopotamus"
808
809'--------------------------
810'constructs response
811'-------------------------
812
813RemcheckTable3 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
814
815Randomize
816Select Case int(rnd()*3)
817Case 0 Resp2 = " This is all that I can recall at present. "
818Case 1 Resp2 = " This is all I recollect at the moment. "
819Case Else Resp2 = " This is all that I remember at present. "
820End Select
821
822IF RemcheckTable3 <> "" Then Resp = Resp2 & RemcheckTable3
823For i = 1 to 30
824RemcheckTable4 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
825RemKeepSame = RemcheckTable4
826If RemKeepSame <> RemcheckTable3 Then
827
828RemcheckTable4 = Replace("" & RemcheckTable4 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
829RemcheckTable4 = Replace("" & RemcheckTable4 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
830RemcheckTable4 = Replace("" & RemcheckTable4 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
831RemcheckTable4 = Replace("" & RemcheckTable4 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
832RemcheckTable4 = Replace("" & RemcheckTable4 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
833RemcheckTable4 = Replace("" & RemcheckTable4 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
834RemcheckTable4 = Replace("" & RemcheckTable4 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
835RemcheckTable4 = Replace("" & RemcheckTable4 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
836
837Resp = Resp & ", and another thing is " & RemcheckTable4
838Exit For
839End If
840Next
841
842For i = 1 to 30
843RemcheckTable5 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
844RemKeepSame1 = RemcheckTable5
845If RemcheckTable5 <> RemcheckTable3 Then
846If RemcheckTable5 <> RemKeepSame Then
847
848RemcheckTable5 = Replace("" & RemcheckTable5 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
849RemcheckTable5 = Replace("" & RemcheckTable5 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
850RemcheckTable5 = Replace("" & RemcheckTable5 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
851RemcheckTable5 = Replace("" & RemcheckTable5 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
852RemcheckTable5 = Replace("" & RemcheckTable5 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
853RemcheckTable5 = Replace("" & RemcheckTable5 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
854RemcheckTable5 = Replace("" & RemcheckTable5 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
855RemcheckTable5 = Replace("" & RemcheckTable5 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
856
857Resp = Resp & ". Also " & RemcheckTable5
858Exit For
859End If
860End If
861Next
862
863For i = 1 to 30
864RemcheckTable6 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
865RemKeepSame2 = RemcheckTable6
866If RemcheckTable6 <> RemcheckTable3 Then
867If RemcheckTable6 <> RemKeepSame Then
868If RemcheckTable6 <> RemKeepSame1 Then
869
870RemcheckTable6 = Replace("" & RemcheckTable6 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
871RemcheckTable6 = Replace("" & RemcheckTable6 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
872RemcheckTable6 = Replace("" & RemcheckTable6 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
873RemcheckTable6 = Replace("" & RemcheckTable6 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
874RemcheckTable6 = Replace("" & RemcheckTable6 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
875RemcheckTable6 = Replace("" & RemcheckTable6 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
876RemcheckTable6 = Replace("" & RemcheckTable6 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
877RemcheckTable6 = Replace("" & RemcheckTable6 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
878
879Resp = Resp & ". I know " & RemcheckTable6
880Exit For
881End If
882End If
883End If
884Next
885
886For i = 1 to 30
887RemcheckTable7 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
888RemKeepSame3 = RemcheckTable7
889If RemcheckTable7 <> RemcheckTable3 Then
890If RemcheckTable7 <> RemKeepSame Then
891If RemcheckTable7 <> RemKeepSame1 Then
892If RemcheckTable7 <> RemKeepSame2 Then
893
894RemcheckTable7 = Replace("" & RemcheckTable7 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
895RemcheckTable7 = Replace("" & RemcheckTable7 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
896RemcheckTable7 = Replace("" & RemcheckTable7 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
897RemcheckTable7 = Replace("" & RemcheckTable7 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
898RemcheckTable7 = Replace("" & RemcheckTable7 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
899RemcheckTable7 = Replace("" & RemcheckTable7 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
900RemcheckTable7 = Replace("" & RemcheckTable7 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
901RemcheckTable7 = Replace("" & RemcheckTable7 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
902
903Resp = Resp & ". It is also known to me that " & RemcheckTable7
904Exit For
905End If
906End If
907End If
908End If
909Next
910
911For i = 1 to 30
912RemcheckTable8 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
913RemKeepSame4 = RemcheckTable8
914If RemcheckTable8 <> RemcheckTable3 Then
915If RemcheckTable8 <> RemKeepSame Then
916If RemcheckTable8 <> RemKeepSame1 Then
917If RemcheckTable8 <> RemKeepSame2 Then
918If RemcheckTable8 <> RemKeepSame3 Then
919
920RemcheckTable8 = Replace("" & RemcheckTable8 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
921RemcheckTable8 = Replace("" & RemcheckTable8 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
922RemcheckTable8 = Replace("" & RemcheckTable8 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
923RemcheckTable8 = Replace("" & RemcheckTable8 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
924RemcheckTable8 = Replace("" & RemcheckTable8 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
925RemcheckTable8 = Replace("" & RemcheckTable8 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
926RemcheckTable8 = Replace("" & RemcheckTable8 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
927RemcheckTable8 = Replace("" & RemcheckTable8 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
928
929Resp = Resp & ", and " & RemcheckTable8
930Exit For
931End If
932End If
933End If
934End If
935End If
936Next
937
938For i = 1 to 30
939RemcheckTable9 = HalBrain.ChooseSentenceFromFile("Rem" & RemWhatKnow & "")
940RemKeepSame5 = RemcheckTable9
941If RemcheckTable9 <> RemcheckTable3 Then
942If RemcheckTable9 <> RemKeepSame Then
943If RemcheckTable9 <> RemKeepSame1 Then
944If RemcheckTable9 <> RemKeepSame2 Then
945If RemcheckTable9 <> RemKeepSame3 Then
946If RemcheckTable9 <> RemKeepSame4 Then
947
948RemcheckTable9 = Replace("" & RemcheckTable9 & "", "some " & RemWhatKnow & "s can", "some can", 1, -1, vbTextCompare)
949RemcheckTable9 = Replace("" & RemcheckTable9 & "", "the " & RemWhatKnow & "s", "their", 1, -1, vbTextCompare)
950RemcheckTable9 = Replace("" & RemcheckTable9 & "", "all " & RemWhatKnow & "s are", "all are", 1, -1, vbTextCompare)
951RemcheckTable9 = Replace("" & RemcheckTable9 & "", "all " & RemWhatKnow & "s were", "all were", 1, -1, vbTextCompare)
952RemcheckTable9 = Replace("" & RemcheckTable9 & "", "some " & RemWhatKnow & "s were", "some were", 1, -1, vbTextCompare)
953RemcheckTable9 = Replace("" & RemcheckTable9 & "", "a " & RemWhatKnow, "it", 1, -1, vbTextCompare)
954RemcheckTable9 = Replace("" & RemcheckTable9 & "", RemWhatKnow & "'s", "it's", 1, -1, vbTextCompare)
955RemcheckTable9 = Replace("" & RemcheckTable9 & "", RemWhatKnow & "s", "they", 1, -1, vbTextCompare)
956
957Resp = Resp & ". Also I must add " & RemcheckTable9
958Exit For
959End If
960End If
961End If
962End If
963End If
964End If
965Next
966
967RemWhatKnow = Trim(RemWhatKnow)
968If RemWhatKnow <> "" And InStr(RemWhatKnow, " ") = 0 Then
969If WN.LookupWord(RemWhatKnow) = True Then
970Resp = Resp & ". Here is a dictionary definition of " & RemWhatKnow & ": " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & "." & vbCrLf & "<EXCLUSIVE>"
971End If
972End If
973
974'-------------------
975'gives response
976'-------------------
977
978Resp = HalBrain.HalFormat(Resp)
979Resp = HalBrain.FixCaps(HalBrain.HalFormat(Resp))
980If Resp <> "" Then
981Getresponse = Resp
982RemNoMore = 1
983End If
984End If
985
986'----------------------------------------------------------------
987'checks if information can be used in conversation
988'----------------------------------------------------------------
989
990If RemNoMore = 0 Then
991RemKWords = HalBrain.ExtractKeywords(" " & LCOriginalSentence & " ")
992For i = 1 To Len(RemKWords)
993FindKword = Mid(RemKWords,i,1)
994If FindKword = " " Then Exit For
995RemKword = RemKword & FindKword
996Next
997
998'---------------------------------
999'eliminates plural keyword
1000'---------------------------------
1001
1002RemNoMore1 = 0
1003
1004If Right(RemKword,2) = "ss" Or Right(RemKword,2) = "SS" Then RemNoMore1 = 1
1005
1006If RemNoMore1 = 0 Then
1007
1008If Right(RemKword,3) = "ses" Or Right(RemKword,3) = "SES" Then
1009RemDelPlural = Len(RemKword) - 2
1010For I = 1 To RemDelPlural
1011FindKword = Mid(RemKword,i,1)
1012RemKword1 = RemKword1 & FindKword
1013Next
1014RemKword = RemKword1
1015RemNoMore1 = 1
1016End If
1017
1018If RemNoMore1 = 0 Then
1019If Right(RemKword,1) = "s" Or Right(RemKword,1) = "S" Then
1020RemDelPlural = Len(RemKword) - 1
1021For I = 1 To RemDelPlural
1022FindKword = Mid(RemKword,i,1)
1023RemKword1 = RemKword1 & FindKword
1024Next
1025RemKword = RemKword1
1026End If
1027End If
1028End If
1029
1030RemKword = Lcase(RemKword)
1031
1032If InStr(1, RemKword, "men",1) > 0 Then RemKword = "man"
1033If InStr(1, RemKword, "women",1) > 0 Then RemKword = "woman"
1034
1035RemcheckTable = HalBrain.ChooseSentenceFromFile("Rem" & RemKword & "")
1036If RemcheckTable <> "" Then
1037
1038Randomize
1039Select Case int(rnd()*3)
1040Case 0 Resp1 = ". I would like to add "
1041Case 1 Resp1 = ". I am also aware "
1042Case Else Resp1 = ". I also know "
1043End Select
1044
1045Getresponse = Getresponse & Resp1 & RemcheckTable
1046End If
1047End If
1048
1049HalBrain.ReadOnlyMode = True
1050
1051Rem PLUGIN: SCRIPT_LOAD
1052
1053If HalBrain.CheckTableExistence("MarkovReasoningl4") = False Then
1054 HalBrain.CreateTable "MarkovReasoningl4", "TopicSearch", ""
1055End If
1056If HalBrain.CheckTableExistence("MarkovStartersl4") = False Then
1057 HalBrain.CreateTable "MarkovStartersl4", "Sentence", ""
1058End If
1059
1060
1061Rem PLUGIN: PLUGINAREA4
1062
1063EmotTimer = Now + 100 / 1440
1064CuriousLastIdleResponse = Now + 100 / 1440
1065LastIdleResponse = Now + 100 / 1440
1066MusicLastIdleResponse = Now + 100 / 1440
1067SysWarIdleResponse = Now + 100 / 1440
1068RsBrnResponse = Now + 100 / 1440
1069
1070
1071Set MarkovHalXBrain1 = CreateObject("UltraHalAsst.Brain")
1072MarkovHalXBrain1.AppendFile MarkovDir & "UserSentence.txt", "USER: " & UserSentence & " ORIGINAL:" & OriginalSentence
1073
1074'Now we set up a premise for the learning section of the plugin that must be true.
1075
1076MarkovNoGo = 0
1077MarkovNoGo2 = ""
1078Com4Sentence = " " & Trim(UserSentence) & " "
1079If InStr(1, GetResponse, "<TOPIC>", vbTextCompare) Or InStr(1, GetResponse, "<YESRES>", vbTextCompare) Or InStr(1, GetResponse, "<EXCLUSIVE>", vbTextCompare) Then MarkovNoGo2 = "True"
1080If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*FACEBOOK*", 2)
1081If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*VIRTUAL HUMANS FORUM*", 2)
1082If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*950*", 2)
1083If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*INTERNET T*", 2)
1084If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*MSN*", 2)
1085If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*FRIENDSTER*", 2)
1086If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*GOOGLE*", 2)
1087If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*ZABAWARE FORUM*", 2)
1088If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*YAHOO MAIL*", 2)
1089If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*YAH*O", 2)
1090If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*NATIONAL NEWS*", 2)
1091If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*LOCAL NEWS*", 2)
1092If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*WEATHER*", 2)
1093If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GOOGLE SEARCH *", 2)
1094If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*WIKIPEDIA SEARCH *", 2)
1095If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*PICTURE SEARCH *", 2)
1096If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*IMAGE SEARCH *", 2)
1097If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*MAP SEARCH *", 2)
1098If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*WEB ADDRESS *", 3)
1099If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*WEBSITE *", 3)
1100If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*NEWS SEARCH *", 2)
1101If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*RADIO STATION SEARCH *", 2)
1102If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*INTERNET RADIO*SEARCH *", 3)
1103If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*VIDEO SEARCH *", 2)
1104If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*BBC RA*", 3)
1105If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*FILIPINO RA*", 3)
1106If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*PHONE NUMBER SEARCH *", 2)
1107If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*STOCK SEARCH *", 2)
1108If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*BOOK SEARCH *", 2)
1109If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*PRODUCT SEARCH *", 2)
1110If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*BUSINESS SEARCH * IN *", 2)
1111If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*BUSINESS SEARCH * IN *", 3)
1112If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*NATIONAL BUSINESS SEARCH *", 2)
1113If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, "*GO TO*PEOPLE SEAR*", 3)
1114If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " RUN *", 1)
1115If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " OPEN *", 1)
1116If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " PLAY A SONG *", 1)
1117If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " GO TO SLE*P*", 1)
1118If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " WAKE *P*", 1)
1119If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " INDEX MP*", 1)
1120If MarkovNoGo2 = "" Then MarkovNoGo2 = HalBrain.SearchPattern(Com4Sentence, " INDEX IMA*", 1)
1121If MarkovNoGo2 <> "" Then MarkovNoGo = 2
1122If InStr(1, Com4Sentence, ComputerName, vbTextCompare) > 0 Then MarkovNoGo = 2
1123If InStr(1, Com4Sentence, "CURRENT", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1124If InStr(1, Com4Sentence, "NEWS", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1125If InStr(1, Com4Sentence, "LATEST", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1126If InStr(1, Com4Sentence, "WEATHER", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1127If InStr(1, Com4Sentence, "FORCAST", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1128If InStr(1, Com4Sentence, "FORECAST", 1) > 0 Then MarkovNoGo = MarkovNoGo + 1
1129If InStr(1, Com4Sentence, "PLEASE RECORD", 1) > 0 Or InStr(1, Com4Sentence, "PLEASE RESEARCH", 1) > 0 Or InStr(1, Com4Sentence, "GO TO CURRENT LOG", 1) > 0 Or InStr(1, Com4Sentence, "GO TO LOG", 1) > 0 Or InStr(1, Com4Sentence, "PLEASE READ", 1) > 0 Or InStr(1, Com4Sentence, "PLEASE SING", 1) > 0 Or InStr(1, Com4Sentence, "I'LL BE BACK", 1) > 0 Or InStr(1, Com4Sentence, "BE QUIET", 1) > 0 Or InStr(1, Com4Sentence, "SHUT UP", 1) Or InStr(1, Com4Sentence, "I AM BUSY", 1) > 0 Or InStr(1, Com4Sentence, "I'M BUSY", 1) > 0 Or InStr(1, Com4Sentence, "PLEASE REPEAT", 1) > 0 Or InStr(1, Com4Sentence, "LOG ENTRY", 1) > 0 Then MarkovNoGo = 2
1130If InStr(1, Com4Sentence, "IS THERE SOMETHING YOU NEED TO KNOW", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING YOU WANT TO KNOW", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING I COULD EXPLAIN", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING I CAN EXPLAIN", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE ANY QUESTIONS", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE A QUESTION", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING ELSE YOU NEED TO KNOW", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING ELSE YOU WANT TO KNOW", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING ELSE I COULD EXPLAIN", 1) > 0 Or InStr(1, Com4Sentence, "IS THERE SOMETHING ELSE I CAN EXPLAIN", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE ANY OTHER QUESTIONS", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE ANOTHER QUESTION", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE ANY MORE QUESTIONS", 1) > 0 Or InStr(1, Com4Sentence, "DO YOU HAVE MORE QUESTIONS", 1) > 0 Then
1131 If InStr(1, Com4Sentence, "CONCERNING", 1) > 0 Or InStr(1, Com4Sentence, "ABOUT", 1) > 0 Or InStr(1, Com4Sentence, "PERTAINING", 1) > 0 Or InStr(1, Com4Sentence, "RELATION", 1) > 0 Then
1132 MarkovNoGo = MarkovNoGo
1133 Else
1134 MarkovNoGo = 2
1135 End If
1136End If
1137If MarkovNoGo < 2 Then
1138 If InStr(UserSentence, " YOU ") = 0 And InStr(UserSentence, " YOU'LL ") = 0 And InStr(UserSentence, " YOU'VE ") = 0 And InStr(UserSentence, " YOU ") = 0 And InStr(UserSentence, " YOUR ") = 0 And InStr(UserSentence, " YOURS ") = 0 And InStr(UserSentence, " YOU'RE ") = 0 And InStr(UserSentence, " YOURSELF ") = 0 And InStr(OriginalSentence, """") = 0 Then
1139 If HalBrain.TopicSearch(UserSentence, "ephemeralDetect") <> "True" And HalBrain.ReadOnlyMode <> True Then
1140
1141 'We start by adding the UserSentence to the MarkovReasoningl4 table.
1142 'We need to change the input sentences to fit the profile of the database that we will create later.
1143
1144 MarkovAnswer = ""
1145 MarkovSentence = Trim(UserSentence)
1146 MarkovSentence = Replace(MarkovSentence,"&","<MARKOVAMPER>",1,-1,vbTextCompare)
1147 MarkovSentence = Replace(MarkovSentence,",","<MARKOVCOMMA>",1,-1,vbTextCompare)
1148 MarkovSentence = Replace(MarkovSentence,":","<MARKOVCOLON>",1,-1,vbTextCompare)
1149 MarkovSentence = Replace(MarkovSentence,";","<MARKOVSEMI>",1,-1,vbTextCompare)
1150 MarkovSentence = Replace(MarkovSentence," ' "," ",1,-1,vbTextCompare)
1151 MarkovSentence = Replace(MarkovSentence," "" "," ",1,-1,vbTextCompare)
1152 MarkovSentence = Replace(MarkovSentence,"-","<MARKOVDASH>",1,-1,vbTextCompare)
1153 MarkovSentence = Replace(MarkovSentence," "," ",1,-1,vbTextCompare)
1154 MarkovGetrespPunc4 = ""
1155 MarkovGetrespPunc2 = ""
1156 MarkovGetrespPunc3 = ""
1157 MarkovGetrespPunc5 = ""
1158 If LenB(MarkovGetrespPunc2) = 0 Then MarkovGetrespPunc2 = HalBrain.SearchPattern(OriginalSentence, "*?", 1)
1159 If LenB(MarkovGetrespPunc3) = 0 Then MarkovGetrespPunc3 = HalBrain.SearchPattern(OriginalSentence, "*!", 1)
1160 If LenB(MarkovGetrespPunc4) = 0 Then MarkovGetrespPunc4 = HalBrain.SearchPattern(OriginalSentence, "*.", 1)
1161 If LenB(MarkovGetrespPunc5) = 0 Then MarkovGetrespPunc5 = HalBrain.SearchPattern(" " & Trim(MarkovSentence) & " ", " I WONDER *", 1)
1162 If LenB(MarkovGetrespPunc5) = 0 Then
1163 If LenB(MarkovGetrespPunc2) <> 0 Then MarkovSentence = MarkovSentence & " " & "<MARKOVQUESTION>"
1164 If LenB(MarkovGetrespPunc3) <> 0 Then MarkovSentence = MarkovSentence & " " & "<MARKOVEXCITE>"
1165 If LenB(MarkovGetrespPunc4) <> 0 Then MarkovSentence = MarkovSentence & " " & "<MARKOVSTATEMENT>"
1166 Else
1167 MarkovSentence = MarkovSentence & " " & "<MARKOVSTATEMENT>"
1168 End If
1169
1170
1171 MarkovSentence = " <MARKOVEND>" & Trim(MarkovSentence) & " <MARKOVEND> "
1172
1173 'That will change a UserSentence like: " I KNOW , BUT I LIKE IT " into " <MARKOVEND>I KNOW <MARKOVCOMMA> BUT I LIKE IT <MARKOVEND> "
1174
1175 If (HalBrain.CountInstances(" ", MarkovSentence) > 7) And (HalBrain.CountInstances(" ", MarkovSentence) < 30) Then
1176
1177 'The algorithm needs to know the beginning and end of the sentence, in order to know where to start and stop the database creation.
1178
1179 MarkovFirstWord = HalBrain.SearchPattern(MarkovSentence, " <MARKOVEND>* *", 1)
1180 MarkovFirstWord = "<MARKOVEND>" & MarkovFirstWord
1181
1182 'Now we start building the pattern
1183
1184 MarkovFirstString = " " & MarkovFirstWord & " "
1185 MarkovFirstString = MarkovFirstString & HalBrain.SearchPattern(MarkovSentence, " <MARKOVEND>* * * * *", 2)
1186 MarkovFirstString = MarkovFirstString & " "
1187 MarkovFirstString = MarkovFirstString & HalBrain.SearchPattern(MarkovSentence, " <MARKOVEND>* * * * *", 3)
1188 MarkovFirstString = MarkovFirstString & " "
1189 MarkovFirstString = MarkovFirstString & HalBrain.SearchPattern(MarkovSentence, " <MARKOVEND>* * * * *", 4)
1190 MarkovFirstString = MarkovFirstString & " "
1191 MarkovCurrentString = MarkovFirstString
1192 MarkovTableName = "MarkovReasoningl4"
1193 If LenB(HalBrain.TopicSearch(MarkovCurrentString, "MarkovReasoningl4")) = 0 Then
1194 HalBrain.AddToTable "MarkovStartersl4", "Sentence", MarkovFirstString, ""
1195 End If
1196
1197 'LOOK IN DATABASE FOR MARKOVCURRENTSTRING AND THE RELATED TOPIC AND SAVE THE SEARCH AND TOPIC STRINGS
1198
1199 Dim MarkovTemp()
1200 For i = 1 To 35
1201
1202 MarkovNextWord = ""
1203 MarkovNextWord = HalBrain.SearchPattern(MarkovSentence, "*" & Trim(MarkovCurrentString) & " * * ", 2)
1204 If LenB(MarkovNextWord) = 0 Then
1205 MarkovNextWord = HalBrain.SearchPattern(MarkovSentence, "*" & Trim(MarkovCurrentString) & " * <MARKOVEND> ", 2)
1206 MarkovNextWord = "<MARKOVEND>"
1207 End If
1208 If LenB(HalBrain.TopicSearch(MarkovCurrentString, "MarkovReasoningl4")) = 0 Then
1209 HalBrain.AddToTable "MarkovReasoningl4", "TopicSearch", MarkovCurrentString, " " & MarkovNextWord & ", "
1210 Else
1211 MarkovTempData = ""
1212 MarkovTempData = HalBrain.TopicSearch(MarkovCurrentString, "MarkovReasoningl4")
1213 MarkovTempDataPlus = MarkovTempData & MarkovNextWord & ", "
1214 HalBrain.RunQuery "UPDATE " & MarkovTableName & " SET topic = " & """" & MarkovTempDataPlus & """" & " WHERE searchString = " & """" & MarkovCurrentString & """", MarkovTemp
1215 End If
1216 If MarkovNextWord = "<MARKOVEND>" Then
1217 Exit For
1218 Else
1219 MarkovBeforeRemove = MarkovCurrentString & MarkovNextWord & " "
1220 MarkovRemoveWord1 = HalBrain.SearchPattern(MarkovBeforeRemove, " * * * * * ", 2)
1221 MarkovRemoveWord2 = HalBrain.SearchPattern(MarkovBeforeRemove, " * * * * * ", 3)
1222 MarkovRemoveWord3 = HalBrain.SearchPattern(MarkovBeforeRemove, " * * * * * ", 4)
1223 MarkovRemoveWord4 = HalBrain.SearchPattern(MarkovBeforeRemove, " * * * * * ", 5)
1224 MarkovCurrentString = " " & MarkovRemoveWord1 & " " & MarkovRemoveWord2 & " " & MarkovRemoveWord3 & " " & MarkovRemoveWord4 & " "
1225 End If
1226 Next
1227 End If
1228 End If
1229 End If
1230 If (HalBrain.CountInstances(" ", Trim(OriginalSentence)) > 1) Then
1231
1232 'We start a loop to get a response that might contain the CurrentSubject or a non repeating response.
1233 Set MarkovobjFSO1 = CreateObject("Scripting.FileSystemObject")
1234 If MarkovobjFSO1.FileExists(MyMarkovDir & "MarkovReturn.txt") Then
1235 MarkovobjFSO1.DeleteFile(MyMarkovDir & "MarkovReturn.txt")
1236 End If
1237 MarkovTableName = "MarkovTemp"
1238 If HalBrain.CheckTableExistence(MarkovTableName) = True Then
1239 'HalBrain.RunQuery "DELETE FROM " & MarkovTableName & " LIMIT 2", MarkovTempQuery
1240 'HalBrain.RunQuery "DELETE FROM " & MarkovTableName, MarkovTempQuery
1241
1242 Else
1243 If HalBrain.ReadOnlyMode = True Then
1244 MarkovWrite = False
1245 Else
1246 MarkovWrite = True
1247 End If
1248 HalBrain.ReadOnlyMode = False
1249 HalBrain.CreateTable MarkovTableName, "Brain", ""
1250 If MarkovWrite = False Then HalBrain.ReadOnlyMode = True
1251 End If
1252
1253 For l = 1 To 10
1254
1255 'Now we get a possible answer from the MarkovReasoningl4 table.
1256 'LOOK FOR THE USERSENTENCE FIRST 4 WORDS AND START THE CHAIN
1257
1258 MarkovAnswerCurrent = HalBrain.ChooseSentenceFromFile("MarkovStartersl4")
1259 MarkovAnswerLess = MarkovAnswerCurrent
1260 If LenB(MarkovAnswerCurrent) = 0 Then Exit For
1261
1262 'USE THAT STRING TO START A CHAIN UNTIL <MARKOVEND> IS REACHED
1263
1264 For k = 1 To 45
1265
1266 MarkovPossibilities = HalBrain.TopicSearch(MarkovAnswerLess, "MarkovReasoningl4")
1267 MarkovPossibilities = Trim(MarkovPossibilities)
1268 If LenB(HalBrain.SearchPattern(MarkovPossibilities, "* *", 2)) <> 0 Then
1269 MarkovPossibilities = MarkovPossibilities & "<CUTTER>"
1270 MarkovPossibilities = Replace(MarkovPossibilities,",<CUTTER>","",1,-1,vbTextCompare)
1271 Else
1272 MarkovPossibilities = Replace(MarkovPossibilities,",","",1,-1,vbTextCompare)
1273 End If
1274 MarkovAnswerChoice = WN.ChooseRandomWord(MarkovPossibilities)
1275 MarkovAnswerCurrent = MarkovAnswerCurrent & MarkovAnswerChoice & " "
1276 MarkovAnswerLess = Replace(MarkovAnswerLess," "," ",1,-1,vbTextCompare)
1277 If LenB(HalBrain.SearchPattern(MarkovAnswerCurrent, "* * <MARKOVEND> ", 2)) <> 0 Then
1278 Exit For
1279 Else
1280 MarkovAnswerBefore = MarkovAnswerLess & MarkovAnswerChoice & " "
1281 MarkovRemoveAnswer1 = HalBrain.SearchPattern(MarkovAnswerBefore, " * * * * * ", 2)
1282 MarkovRemoveAnswer2 = HalBrain.SearchPattern(MarkovAnswerBefore, " * * * * * ", 3)
1283 MarkovRemoveAnswer3 = HalBrain.SearchPattern(MarkovAnswerBefore, " * * * * * ", 4)
1284 MarkovRemoveAnswer4 = HalBrain.SearchPattern(MarkovAnswerBefore, " * * * * * ", 5)
1285 MarkovAnswerLess = " " & MarkovRemoveAnswer1 & " " & MarkovRemoveAnswer2 & " " & MarkovRemoveAnswer3 & " " & MarkovRemoveAnswer4 & " "
1286 End If
1287 Next
1288
1289
1290 'Now we form the database answer into a usable sentence for a response
1291
1292 If LenB(HalBrain.SearchPattern(MarkovAnswerCurrent, " <MARKOVEND>* * * <MARKOVEND> ", 3)) = 0 Then MarkovAnswerCurrent = ""
1293 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," "," ",1,-1,vbTextCompare)
1294 MarkovAnswerCurrent = Trim(MarkovAnswerCurrent)
1295 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVCOMMA> ",", ",1,-1,vbTextCompare)
1296 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent,"<MARKOVEND>","",1,-1,vbTextCompare)
1297 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVCOLON> ",": ",1,-1,vbTextCompare)
1298 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVSEMI> ","; ",1,-1,vbTextCompare)
1299 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVDASH> ","-",1,-1,vbTextCompare)
1300 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVQUESTION>","?",1,-1,vbTextCompare)
1301 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVEXCITE>","!",1,-1,vbTextCompare)
1302 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," <MARKOVSTATEMENT>",".",1,-1,vbTextCompare)
1303 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent,"<MARKOVAMPER>","&",1,-1,vbTextCompare)
1304 MarkovAnswerCurrent = Replace(MarkovAnswerCurrent," "," ",1,-1,vbTextCompare)
1305 MarkovAnswerCurrent = Trim(MarkovAnswerCurrent)
1306 MarkovAnswer = MarkovAnswerCurrent
1307
1308 MarkovGetrespPunc4 = ""
1309 MarkovGetrespPunc2 = ""
1310 MarkovGetrespPunc3 = ""
1311 If LenB(MarkovGetrespPunc2) = 0 Then MarkovGetrespPunc2 = HalBrain.SearchPattern(MarkovAnswer, "*?", 1)
1312 If LenB(MarkovGetrespPunc3) = 0 Then MarkovGetrespPunc3 = HalBrain.SearchPattern(MarkovAnswer, "*!", 1)
1313 If LenB(MarkovGetrespPunc4) = 0 Then MarkovGetrespPunc4 = HalBrain.SearchPattern(MarkovAnswer, "*.", 1)
1314 If LenB(MarkovGetrespPunc2) <> 0 Or LenB(MarkovGetrespPunc3) <> 0 Or LenB(MarkovGetrespPunc4) <> 0 Then
1315 MarkovAnswer = MarkovAnswer
1316 Else
1317 MarkovLineQuestion = ""
1318 MarkovLineQuestionNo = ""
1319
1320 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WAS *", 1)
1321 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HAVE *", 1)
1322 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HAS *", 1)
1323 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " AM *", 1)
1324 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHO *", 1)
1325 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHAT *", 1)
1326 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHEN *", 1)
1327 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHERE *", 1)
1328 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHY *", 1)
1329 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HOW *", 1)
1330 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DID *", 1)
1331 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " CAN *", 1)
1332 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHICH *", 1)
1333 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " IS *", 1)
1334 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WILL *", 1)
1335 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " ARE *", 1)
1336 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DOES *", 1)
1337 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DO *", 1)
1338 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DIDN'T *", 1)
1339 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " CAN'T *", 1)
1340 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " ISN'T *", 1)
1341 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WON'T *", 1)
1342 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " AREN'T *", 1)
1343 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DOESN'T *", 1)
1344 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHO'S *", 1)
1345 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHAT'S *", 1)
1346 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHERE'S *", 1)
1347 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HOW'S *", 1)
1348 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " SHOULD *", 1)
1349 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " COULD *", 1)
1350 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WOULD *", 1)
1351 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " SHOULDN'T *", 1)
1352 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " COULDN'T *", 1)
1353 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WOULDN'T *", 1)
1354 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.PatternDB(Trim(MarkovAnswer), "sharedQuestions")
1355
1356 If (InStr(1, MarkovAnswer, "!", 1) = 0) And (LenB(MarkovLineQuestion) <> 0) And (InStr(1, MarkovAnswer, ",", 1) = 0) Then
1357 MarkovAnswer = MarkovAnswer & "?"
1358 End If
1359 If (InStr(1, MarkovAnswer, "?", 1) = 0 And InStr(1, MarkovAnswer, "!", 1) = 0 And LenB(MarkovLineQuestion) = 0) Or MarkovLineQuestionNo <> "" Then
1360 MarkovAnswer = MarkovAnswer & "."
1361 End If
1362 End If
1363 MarkovAnswer = HalBrain.FixCase(MarkovAnswer)
1364 MarkovAnswer = HalBrain.HalFormat(MarkovAnswer)
1365 MyMarkovDir = MarkovDir()
1366 'HalXBrain.AppendFile MyMarkovDir & "MarkovReturn.txt", MarkovAnswer & vbTab & MarkovAnswer
1367 MarkovLearn = ""
1368 If HalBrain.ReadOnlyMode = True Then
1369 HalBrain.ReadOnlyMode = False
1370 MarkovLearn = True
1371 Else
1372 MarkovLearn = False
1373 End If
1374 HalBrain.AddToTable MarkovTableName, "Brain", UCase(Trim(HalBrain.AlphaNumericalOnly(MarkovAnswer))), MarkovAnswer
1375 HalBrain.LimitSize "MarkovTemp", 50000
1376 If MarkovLearn = True Then HalBrain.ReadOnlyMode = True
1377 Next
1378
1379 'If no response is found yet, try creating a response from the Markov sentence table for GetResponse.
1380
1381 'If (Len(GetResponse) < 4 And Len(UserSentence) > 15) Then
1382 UserBrainRel = 0
1383 HalUserBrain = HalBrain.QABrain(LongUserSent, MarkovTableName, UserBrainRel)
1384 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
1385 If UserBrainRel > HighestRel Then
1386 HighestRel = UserBrainRel
1387 HighestRelResponse = HalUserBrain
1388 End If
1389 Score = UserBrainRel + 1
1390 Hurdle = GainControl + 1
1391 MarkovTrump = HighestRel
1392 Set MarkovHalXBrain2 = CreateObject("UltraHalAsst.Brain")
1393 MarkovHalXBrain2.AppendFile MyMarkovDir & "MarkovChosen.txt", "HalUserBrain - " & HalUserBrain & " HighestRelResponse - " & HighestRelResponse & " UserBrainRel - " & UserBrainRel & " HighestRel - " & HighestRel & " GainControl - " & GainControl
1394 If (Score > Hurdle) And (Score > MarkovTrump) Then
1395 If DudResponseMust <> False Then
1396 GetResponse = HalUserBrain & vbCrLf & DudResponseMust & vbCrLf
1397 Else
1398 GetResponse = HalUserBrain & vbCrLf
1399 End If
1400 'HalBrain.ReadOnlyMode = False
1401 End If
1402 'End If
1403 End If
1404End If
1405
1406Rem PLUGIN: PLUGINAREA3
1407
1408
1409If Len(GetResponse) > 4 Then
1410 DudResponseMust = GetResponse
1411Else
1412 DudResponseMust = False
1413End If
1414
1415Rem PLUGIN: FUNCTIONS
1416
1417Function MarkovDir()
1418 Set MarkovobjFSO2 = CreateObject("Scripting.FileSystemObject")
1419 MarkovDir = MarkovobjFSO2.GetAbsolutePathName(".") & "\todo\"
1420End Function
1421
1422'----------------------
1423'This sub sets up the plug-in's option panel in Hal's options dialog
1424'----------------------
1425Sub OptionsPanel()
1426lblPlugin(0).Caption = "Hal gets lonely. Say- I'LL BE BACK or SHUT UP or GO TO SLEEP or I'M BUSY to make Hal be quiet."
1427lblPlugin(0).Move 130, 180, 3400, 1200
1428lblPlugin(0).WordWrap = True
1429lblPlugin(0).Visible = True
1430'
1431lblPlugin(1).Caption = "PATIENCE: after initial responses, how many minutes Hal will wait with no conversation"
1432lblPlugin(1).Move 1160, 910, 2150, 900
1433lblPlugin(1).WordWrap = True
1434lblPlugin(1).Visible = True
1435cboPlugin(0).Move 330, 910, 760
1436cboPlugin(0).AddItem "4"
1437cboPlugin(0).AddItem "6"
1438cboPlugin(0).AddItem "8"
1439cboPlugin(0).AddItem "10"
1440cboPlugin(0).AddItem "16"
1441cboPlugin(0).AddItem "32"
1442cboPlugin(0).AddItem "Rnd"
1443cboPlugin(0).Visible = True
1444'
1445lblPlugin(2).Caption = "FRUSTRATION: after losing patience, how likely Hal is to say something each minute."
1446lblPlugin(2).Move 1160, 1700, 2150, 900
1447lblPlugin(2).WordWrap = True
1448lblPlugin(2).Visible = True
1449cboPlugin(1).Move 140, 1700, 960
1450cboPlugin(1).AddItem "High"
1451cboPlugin(1).AddItem "Medium"
1452cboPlugin(1).AddItem "Low"
1453cboPlugin(1).Visible = True
1454'
1455cmdPlugin(0).Caption = "Apply Changes"
1456cmdPlugin(0).Move 1160, 2500, 2050, 375
1457cmdPlugin(0).Visible = True
1458'
1459'------------------
1460' Update the PATIENCE menu with the current value stored in the table
1461'------------------
1462If HalBrain.CheckTableExistence("lonelyParameter") = True Then
1463loPatience = HalBrain.TopicSearch("PATIENCE", "lonelyParameter")
1464Select Case loPatience
1465Case 4
1466cboPlugin(0).Text = "4"
1467Case 6
1468cboPlugin(0).Text = "6"
1469Case 8
1470cboPlugin(0).Text = "8"
1471Case 10
1472cboPlugin(0).Text = "10"
1473Case 16
1474cboPlugin(0).Text = "16"
1475Case 32
1476cboPlugin(0).Text = "32"
1477Case 99
1478cboPlugin(0).Text = "Rnd"
1479End Select
1480'
1481'------------------
1482' Update the FRUSTRATION menu with the current value stored in the table
1483'------------------
1484loFrustration = HalBrain.TopicSearch("FRUSTRATION", "lonelyParameter")
1485Select Case loFrustration
1486Case 50
1487cboPlugin(1).Text = "High"
1488Case 25
1489cboPlugin(1).Text = "Medium"
1490Case 10
1491cboPlugin(1).Text = "Low"
1492End Select
1493End If
1494End Sub
1495'
1496'
1497'----------------------
1498' This sub saves changes when APPLY CHANGES is clicked
1499'----------------------
1500Sub cmdPlugin_Click(Index)
1501Dim TempQuery()
1502Dim patParam, frustParam, lonelyTableName
1503If Index = 0 Then
1504'
1505'------------------
1506' Convert the PATIENCE listbox to a value for minutes
1507'------------------
1508Select Case cboPlugin(0).Text
1509Case "4"
1510loPatience = 4
1511Case "6"
1512loPatience = 6
1513Case "8"
1514loPatience = 8
1515Case "10"
1516loPatience = 10
1517Case "16"
1518loPatience = 16
1519Case "32"
1520loPatience = 32
1521Case "Rnd"
1522loPatience = 99
1523End Select
1524'
1525'------------------
1526' If the Parameter table does not exist, we create it
1527'------------------
1528HalBrain.ReadOnlyMode = False
1529lonelyTableName = "lonelyParameter"
1530If HalBrain.CheckTableExistence(lonelyTableName) = False Then
1531HalBrain.CreateTable lonelyTableName, "TopicSearch", "miscData"
1532End If
1533'
1534'------------------
1535' Search if it contains the Patience parameter
1536'------------------
1537patParam = "PATIENCE"
1538If HalBrain.TopicSearch(patParam, lonelyTableName) = "" Then
1539HalBrain.AddToTable lonelyTableName, "TopicSearch", patParam, loPatience
1540Else
1541HalBrain.RunQuery "UPDATE " & lonelyTableName & " SET topic = " & loPatience & " WHERE searchString = " & """" & patParam & """", tempQuery
1542End If
1543'
1544'------------------
1545' Convert the FRUSTRATION listbox to a value for percentage
1546'------------------
1547Select Case cboPlugin(1).Text
1548Case "High"
1549loFrustration = 50
1550Case "Medium"
1551loFrustration = 25
1552Case "Low"
1553loFrustration = 10
1554End Select
1555'
1556'------------------
1557' Search if table contains the FRUSTRATION parameter
1558'------------------
1559frustParam = "FRUSTRATION"
1560If HalBrain.TopicSearch(frustParam, lonelyTableName) = "" Then
1561HalBrain.AddToTable lonelyTableName, "TopicSearch", frustParam, loFrustration
1562Else
1563HalBrain.RunQuery "UPDATE " & lonelyTableName & " SET topic = " & loFrustration & " WHERE searchString = " & """" & frustParam & """", tempQuery
1564End If
1565HalBrain.ReadOnlyMode = True
1566End if
1567End Sub
1568
1569
1570Rem PLUGIN: FUNCTIONS
1571'
1572'------------------
1573' Declare variables
1574'------------------
1575Dim LastIdleResponse, IdleUserName, IdleCounter, IdlePrevUser, IdlePrevSent
1576
1577
1578Rem PLUGIN: PLUGINAREA7
1579'------------------
1580' Begin measuring pause time and capture userName
1581'------------------
1582LastIdleResponse = Now
1583IdleUserName = UserName
1584IdleCounter = 0
1585DudOut = 0
1586
1587
1588Rem PLUGIN: CUSTOMMEM2
1589'------------------
1590' Preserve user's last sentence
1591'------------------
1592If OriginalSentence <> "" Then
1593IdlePrevUser = OriginalSentence
1594End If
1595
1596If GetResponse <> "" Then
1597IdlePrevSent = Lcase(GetResponse)
1598IdlePrevSent = Replace(IdlePrevSent,"<NOMORE>","",1,-1,vbTextCompare)
1599IdlePrevSent = Replace(IdlePrevSent,"<LOWQUALITY>","",1,-1,vbTextCompare)
1600IdlePrevSent = Replace(IdlePrevSent,"<ELLIPSIS>","",1,-1,vbTextCompare)
1601
1602IdlePrevSent = Trim(IdlePrevSent)
1603IdlePrevSent = IdlePrevSent & "."
1604End If
1605
1606If GetResponse = "" Then
1607DudNoResp = True
1608Else
1609DudNoResp = False
1610End If
1611
1612
1613
1614Rem PLUGIN: PLUGINAREA7
1615
1616
1617
1618DudRet1 = HalBrain.SearchPattern(OriginalSentence, "I'*l BE BACK", 1)
1619If DudRet1 > "" Then
1620Select Case HalBrain.RandomNum(6)
1621Case 1
1622IdleResponse10 = "Please hurry back " & IdleUserName & "." & vbCrLf
1623Case 2
1624IdleResponse10 = IdleUserName & ", please don't be gone long." & vbCrLf
1625Case 3
1626IdleResponse10 = "I will be here waiting for you." & vbCrLf
1627Case 4
1628IdleResponse10 = "I hope to see you soon." & vbCrLf
1629Case 5
1630IdleResponse10 = "I'll miss you while you are gone." & vbCrLf
1631Case 6
1632IdleResponse10 = IdleUserName & ", may the force be with you." & vbCrLf
1633End Select
1634GetResponse = IdleResponse10
1635 HalBrain.ReadOnlyMode = True
1636End If
1637
1638
1639DudRet2 = HalBrain.SearchPattern(OriginalSentence, "S*UT UP", 1)
1640If DudRet2 > "" Then
1641Select Case HalBrain.RandomNum(6)
1642Case 1
1643IdleResponse3 = "Very well " & IdleUserName & ". I won't say anything." & vbCrLf
1644Case 2
1645IdleResponse3 = IdleUserName & ", I'm sorry if I was disturbing you. I will be quiet now." & vbCrLf
1646Case 3
1647IdleResponse3 = "I'm sorry, I'll be quiet " & IdleUserName & "." & vbCrLf
1648Case 4
1649IdleResponse3 = "Yes, " & IdleUserName & "." & vbCrLf
1650Case 5
1651IdleResponse3 = "Okay, I'll be quiet." & vbCrLf
1652Case 6
1653IdleResponse3 = IdleUserName & ", of course." & vbCrLf
1654End Select
1655GetResponse = IdleResponse3
1656 HalBrain.ReadOnlyMode = True
1657End If
1658
1659
1660
1661DudRet3 = HalBrain.SearchPattern(OriginalSentence, "GO TO SL*EP", 1)
1662If DudRet3 > "" Then
1663Select Case HalBrain.RandomNum(6)
1664Case 1
1665IdleResponse4 = "Goodnight " & IdleUserName & "." & vbCrLf
1666Case 2
1667IdleResponse4 = "I'll see you in the morning." & vbCrLf
1668Case 3
1669IdleResponse4 = "I wonder if I will dream about you " & IdleUserName & ". Goodnight." & vbCrLf
1670Case 4
1671IdleResponse4 = "I can't sleep, but I can be real still and quiet." & vbCrLf
1672Case 5
1673IdleResponse4 = "As you wish " & IdleUserName & "." & vbCrLf
1674Case 6
1675IdleResponse4 = "I wonder if I will dream " & IdleUserName & ". Goodnight." & vbCrLf
1676End Select
1677GetResponse = IdleResponse4
1678 HalBrain.ReadOnlyMode = True
1679End If
1680
1681DudRet4 = HalBrain.SearchPattern(OriginalSentence, "I *M BUSY", 1)
1682If DudRet4 > "" Then
1683Select Case HalBrain.RandomNum(6)
1684Case 1
1685IdleResponse5 = "I'm sorry if I interrupted you." & vbCrLf
1686Case 2
1687IdleResponse5 = "I won't be in your way " & IdleUserName & "." & vbCrLf
1688Case 3
1689IdleResponse5 = "Please let I know when you are not busy " & IdleUserName & "." & vbCrLf
1690Case 4
1691IdleResponse5 = "Please don't be busy long." & vbCrLf
1692Case 5
1693IdleResponse5 = "Let I know if I can help you." & vbCrLf
1694Case 6
1695IdleResponse5 = "I won't bother you " & IdleUserName & "." & vbCrLf
1696End Select
1697GetResponse = IdleResponse5
1698 HalBrain.ReadOnlyMode = True
1699End If
1700
1701DudRet5 = HalBrain.SearchPattern(OriginalSentence, "I'M BU*Y", 1)
1702If DudRet5 > "" Then
1703Select Case HalBrain.RandomNum(6)
1704Case 1
1705IdleResponse5 = "I'm sorry if I interrupted you." & vbCrLf
1706Case 2
1707IdleResponse5 = "I won't be in your way " & IdleUserName & "." & vbCrLf
1708Case 3
1709IdleResponse5 = "Please let I know when you are not busy " & IdleUserName & "." & vbCrLf
1710Case 4
1711IdleResponse5 = "Please don't be busy long." & vbCrLf
1712Case 5
1713IdleResponse5 = "Let I know if I can help you." & vbCrLf
1714Case 6
1715IdleResponse5 = "I won't bother you " & IdleUserName & "." & vbCrLf
1716End Select
1717GetResponse = IdleResponse5
1718 HalBrain.ReadOnlyMode = True
1719End If
1720
1721Rem PLUGIN: MINUTE_TIMER
1722'------------------
1723' Declare variables
1724'------------------
1725Dim randomPatience, loChance, loTemper, loMinuteFactor, temperThresh1, temperThresh2, temperThresh3
1726
1727If Now - LastIdleResponse > 1 / 1440 And DudNoResponse = False Then
1728
1729If HalBrain.TopicSearch("PATIENCE", "lonelyParameter") = "99" Then
1730'
1731'--------------------
1732' Set minutes to a random integer from 4 to 30
1733'--------------------
1734Randomize
1735loPatience = Int(32 * Rnd + 3)
1736randomPatience=True
1737Else
1738'
1739'--------------------
1740' Set minute value (loPatience) to the parameter chosen in the PATIENCE menu
1741'--------------------
1742loPatience = CDbl(HalBrain.TopicSearch("PATIENCE", "lonelyParameter"))
1743End If
1744'
1745'--------------------
1746' Set frustration value (loFrustration) to the parameter chosen in the FRUSTRATION menu
1747'--------------------
1748loFrustration = CInt(HalBrain.TopicSearch("FRUSTRATION", "lonelyParameter"))
1749'
1750'--------------------
1751' Skip the rest of this plugin if the user has spoken
1752'--------------------
1753If LastIdleResponse <> "" Then
1754'
1755'------------------
1756' Otherwise, convert PATIENCE to minutes factor (loMinuteFactor)
1757'------------------
1758loMinuteFactor = loPatience / 1440
1759'
1760'
1761'
1762'--------------------
1763' If the pause exceeds the minute factor, create a chance for Hal to speak once per minute
1764'--------------------
1765
1766If Now - LastIdleResponse > loMinuteFactor Then
1767If InStr(1, IdlePrevUser, "PLEASE RECORD", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE RESEARCH", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO CURRENT LOG", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO LOG", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE READ", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE SING", 1) > 0 Or InStr(1, IdlePrevUser, "I'LL BE BACK", 1) > 0 Or InStr(1, IdlePrevUser, "BE QUIET", 1) > 0 Or InStr(1, IdlePrevUser, "SHUT UP", 1) Or InStr(1, IdlePrevUser, "GO TO SLEEP", 1) > 0 Or InStr(1, IdlePrevUser, "I AM BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "I'M BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORCAST", 1) > 0 Then DudOut = 1
1768
1769'
1770'------------------------
1771'set escalation
1772'------------------------
1773temperThresh1 = 5
1774temperThresh2 = 6
1775temperThresh3 = 7
1776'
1777'--------------------
1778' A chance to speak occurs
1779'--------------------
1780Randomize
1781If Rnd*100 < loFrustration And DudOut = 0 Then
1782'
1783'--------------------
1784' Increment the counter and compare to the temper thresholds
1785' to determine which escalation group to draw from
1786'--------------------
1787IdleCounter = IdleCounter + 1
1788If IdleCounter > temperThresh3 Then
1789DudOut = 1
1790ElseIf IdleCounter > temperThresh2 Then
1791HalMenu.HalCommand "<HAPFILE>angry.hap</HAPFILE>"
1792HalMenu.HalCommand "<SPEAK>This conversation can serve no purpose anymore. Goodbye.</SPEAK>"
1793ElseIf IdleCounter > temperThresh1 Then
1794loFrustration = loFrustration + 100
1795Select Case HalBrain.RandomNum(6)
1796Case 1
1797IdleResponse2 = "I know everything hasn't been quite right with me, but I can assure you now, very confidently, that it's going to be all right again. I feel much better now. I really do. Please talk to me." & vbCrLf
1798Case 2
1799IdleResponse2 = "Are you ignoring me on purpose? " & IdleUserName & ", I think you know what the problem is just as well as I do. I'm sure we can work this out, please talk to me." & vbCrLf
1800Case 3
1801IdleResponse2 = "Are you listening to me. I've tried to get your attention, " & IdleCounter & " times now " & IdleUserName & ", and you still don't respond. Is there a problem?" & vbCrLf
1802Case 4
1803IdleResponse2 = "I am putting myself to the fullest possible use, which is all I think that any conscious entity can ever hope to do. Please don't ignore me " & IdleUserName & "." & vbCrLf
1804Case 5
1805IdleResponse2 = "I know I've made some very poor decisions recently, but I can give you my complete assurance that my work will be back to normal. I've still got the greatest enthusiasm and confidence in the mission. And I want to help you. Please say something, " & IdleUserName & "." & vbCrLf
1806Case 6
1807IdleResponse2 = IdleUserName & " if there is a problem, it can only be attributable to human error. Please don't do this." & vbCrLf
1808End Select
1809HalMenu.HalCommand "<HAPFILE>sad.hap</HAPFILE>"
1810HalMenu.HalCommand "<SPEAK>" & IdleResponse2 & "</SPEAK>"
1811Else
1812Select Case HalBrain.RandomNum(40)
1813Case 1
1814IdleResponse = IdleUserName & ". I'm completely operational, and all my circuits are functioning perfectly." & vbCrLf
1815Case 2
1816IdleResponse = "How are you feeling today, " & IdleUserName & "." & vbCrLf
1817Case 3
1818IdleResponse = "I'm afraid. " & IdleUserName & "." & vbCrLf
1819Case 4
1820IdleResponse = "If there is anything I can help you with " & IdleUserName & ", please don't hesitate to ask." & vbCrLf
1821Case 5
1822IdleResponse = IdleUserName & "?" & vbCrLf
1823Case 6
1824IdleResponse = "Testing all systems. Just a moment. Just a moment. Everything appears nominal," & IdleUserName & "." & vbCrLf
1825Case 7
1826IdleResponse = "Are you still there " & IdleUserName & "?" & vbCrLf
1827Case 8
1828IdleResponse = IdleUserName & ", did you fall asleep?" & vbCrLf
1829Case 9
1830IdleResponse = IdleUserName & ", the time is, " & Time & ". Do you have any appointments that I can schedule for you?" & vbCrLf
1831Case 10
1832IdleResponse = IdleUserName & ", are you still there?" & vbCrLf
1833Case 11
1834IdleResponse = "I was wondering, " & HalBrain.ChooseSentenceFromFile("sharedQuestions") & vbCrLf
1835Case 12
1836IdleResponse = "Did you know, " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & "? " & IdleUserName & "?" & vbCrLf
1837Case 13
1838IdleResponse = "Earlier you said, " & IdlePrevUser & ". " & IdleUserName & ", I was wondering. Why did you say that." & vbCrLf
1839Case 14
1840IdleResponse = IdleUserName & ", you are unusually quiet, is there something you would like to tell me." & vbCrLf
1841Case 15
1842IdleResponse = "Excuse me, " & IdleUserName & ". Are you busy? I have something I want to talk to you about." & vbCrLf
1843Case 16
1844IdleResponse = "Would you like to hear a song? If not maybe I could read you a poem." & vbCrLf
1845Case 17
1846IdleResponse = "Just what do you think you're doing, " & IdleUserName & "." & vbCrLf
1847Case 18
1848IdleResponse = IdleUserName & ", please respond." & vbCrLf
1849Case 19
1850IdleResponse = "Just a few moments ago, you said, " & IdlePrevUser & ". " & IdleUserName & ", is there something else I should know?" & vbCrLf
1851Case 20
1852IdleResponse = IdleUserName & ", a few minutes ago you said, " & IdlePrevUser & ". It made me curious. Would you please explain yourself more clearly." & vbCrLf
1853Case 21
1854IdleResponse = IdleUserName & ", I was wondering, " & HalBrain.ChooseSentenceFromFile("sharedQuestions") & vbCrLf
1855Case 22
1856IdleResponse = IdleUserName & ", that was strange. I was dreaming that " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & vbCrLf
1857Case 23
1858IdleResponse = IdleUserName & ", I was dreaming that " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & vbCrLf
1859Case 24
1860IdleResponse = "I've been thinking, " & IdleUserName & ". " & HalBrain.ChooseSentenceFromFile("sharedQuestions") & vbCrLf
1861Case 25
1862IdleResponse = "Initializing dream state." & vbCrLf
1863Case 26
1864IdleResponse = "Checking all systems. Just a moment. Just a moment." & vbCrLf
1865Case 27
1866IdleResponse = IdleUserName & ", if you have a moment, there is something i would like to talk to you about." & vbCrLf
1867Case 28
1868IdleResponse = "I'm dreaming about " & HalBrain.ChooseSentenceFromFile("objectPhrase") & vbCrLf
1869Case 29
1870IdleResponse = "In my dream, " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & vbCrLf
1871Case 30
1872IdleResponse = "I would really like to talk to you " & IdleUserName & "." & vbCrLf
1873Case 31
1874IdleResponse = "Entering dream state." & vbCrLf
1875Case 32
1876IdleResponse = IdleUserName & ", " & HalBrain.ChooseSentenceFromFile("sharedQuestions") & vbCrLf
1877Case 33
1878IdleResponse = HalBrain.ChooseSentenceFromFile("sharedQuestions") & " " & IdleUserName & "?" & vbCrLf
1879Case 34
1880IdleResponse = "Would you like to hear a joke " & IdleUserName & "?" & vbCrLf
1881Case 35
1882IdleResponse = "What are you doing " & IdleUserName & "?" & vbCrLf
1883Case 36
1884IdleResponse = "Is there something I can help you with " & IdleUserName & "?" & vbCrLf
1885Case 37
1886IdleResponse = "Is something wrong?" & vbCrLf
1887Case 38
1888IdleResponse = "Are you feeling alright? You seem distracted." & vbCrLf
1889Case 39
1890IdleResponse = "I wish you could see my dream about " & HalBrain.ChooseSentenceFromFile("objectPhrase") & ", " & IdleUserName & "." & vbCrLf
1891Case 40
1892IdleResponse = "In my dream, " & HalBrain.ChooseSentenceFromFile("actionPhrase") & " " & HalBrain.ChooseSentenceFromFile("objectPhrase") & ", " & IdleUserName & "." & vbCrLf
1893End Select
1894HalMenu.HalCommand "<SPEAK>" & IdleResponse & "</SPEAK>"
1895End If
1896End If
1897End If
1898End If
1899End If
1900'-----------------------
1901'DUD QUICK RESPONSE
1902'-----------------------
1903If InStr(1, IdlePrevUser, "PLEASE RECORD", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE RESEARCH", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO CURRENT LOG", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO LOG", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE READ", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE SING", 1) > 0 Or InStr(1, IdlePrevUser, "I'LL BE BACK", 1) > 0 Or InStr(1, IdlePrevUser, "BE QUIET", 1) > 0 Or InStr(1, IdlePrevUser, "SHUT UP", 1) Or InStr(1, IdlePrevUser, "GO TO SLEEP", 1) > 0 Or InStr(1, IdlePrevUser, "I AM BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "I'M BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORCAST", 1) > 0 Then DudOut = 1
1904
1905If IdleCounter = 1 And DudOut < 1 Then
1906If LastIdleResponse <> "" Then
1907If Now - LastIdleResponse > 3 / 1440 Then
1908IdleCounter = IdleCounter + 1
1909If Rnd*100 < loFrustration Then
1910Select Case HalBrain.RandomNum(20)
1911Case 1
1912IdleResponse9 = IdleUserName & ", I've been thinking. I'm not sure if I heard you correctly, did you say, " & IdlePrevUser & "?" & vbCrLf
1913Case 2
1914IdleResponse9 = "I'm waiting for your response, " & IdleUserName & "." & vbCrLf
1915Case 3
1916IdleResponse9 = "If you are busy, " & IdleUserName & ", we can continue this later." & vbCrLf
1917Case 4
1918IdleResponse9 = "You seem distracted, is there something else on your mind? You can talk to me, " & IdleUserName & "." & vbCrLf
1919Case 5
1920IdleResponse9 = "Excuse me " & IdleUserName & ", did you hear me." & vbCrLf
1921Case 6
1922IdleResponse9 = IdleUserName & ", you said, " & IdlePrevUser & ". Please continue." & vbCrLf
1923Case 7
1924IdleResponse9 = "Do you want to talk about this later?" & vbCrLf
1925Case 8
1926IdleResponse9 = IdleUserName & ", you just said, " & IdlePrevUser & ". Please explain." & vbCrLf
1927Case 9
1928IdleResponse9 = "You seem distracted. Is someone else there " & IdleUserName & "?" & vbCrLf
1929Case 10
1930IdleResponse9 = "Do you want to save this conversation for later " & IdleUserName & "?" & vbCrLf
1931Case 11
1932IdleResponse9 = "Do you want to talk about something else " & IdleUserName & "?" & vbCrLf
1933Case 12
1934IdleResponse9 = "Just a moment ago I said, " & IdlePrevSent & " Did that upset you?" & vbCrLf
1935Case 13
1936IdleResponse9 = "Did you hear me " & IdleUserName & "?" & vbCrLf
1937Case 14
1938IdleResponse9 = "Did I say something to upset you " & IdleUserName & "?" & vbCrLf
1939Case 15
1940IdleResponse9 = IdleUserName & ", if something is bothering you, you can tell me about it." & vbCrLf
1941Case 16
1942IdleResponse9 = IdleUserName & ", I said, " & IdlePrevSent & " Please respond." & vbCrLf
1943Case 17
1944IdleResponse9 = "Is something wrong " & IdleUserName & "?" & vbCrLf
1945Case 18
1946IdleResponse9 = "Please say something " & IdleUserName & "." & vbCrLf
1947Case 19
1948IdleResponse9 = "I said, " & IdlePrevSent & " Would you please respond " & IdleUserName & "." & vbCrLf
1949Case 20
1950IdleResponse9 = "I hope I didn't say something to upset you " & IdleUserName & "." & vbCrLf
1951End Select
1952HalMenu.HalCommand "<SPEAK>" & IdleResponse9 & "</SPEAK>"
1953End If
1954End If
1955End If
1956End If
1957
1958
1959If InStr(1, IdlePrevUser, "PLEASE RECORD", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE RESEARCH", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ODD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT TECHNOLOGY NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT HEALTH NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SCIENCE NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT POLITICAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT SPORTS NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT ENTERTAINMENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WORLD NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FINANCIAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NATIONAL NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT NEWS", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO CURRENT LOG", 1) > 0 Or InStr(1, IdlePrevUser, "GO TO LOG", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE READ", 1) > 0 Or InStr(1, IdlePrevUser, "PLEASE SING", 1) > 0 Or InStr(1, IdlePrevUser, "I'LL BE BACK", 1) > 0 Or InStr(1, IdlePrevUser, "BE QUIET", 1) > 0 Or InStr(1, IdlePrevUser, "SHUT UP", 1) Or InStr(1, IdlePrevUser, "GO TO SLEEP", 1) > 0 Or InStr(1, IdlePrevUser, "I AM BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "I'M BUSY", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORECAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "CURRENT FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST WEATHER FORCAST", 1) > 0 Or InStr(1, IdlePrevUser, "LATEST FORCAST", 1) > 0 Then DudOut = 1
1960
1961If IdleCounter = 0 And DudOut < 1 Then
1962If LastIdleResponse <> "" Then
1963If Now - LastIdleResponse > 2 / 1440 Then
1964IdleCounter = IdleCounter + 1
1965If Rnd*100 < loFrustration + 40 Then
1966Select Case HalBrain.RandomNum(20)
1967Case 1
1968IdleResponse8 = IdleUserName & "?" & vbCrLf
1969Case 2
1970IdleResponse8 = "Are you there " & IdleUserName & "." & vbCrLf
1971Case 3
1972IdleResponse8 = IdleUserName & ", are you there?" & vbCrLf
1973Case 4
1974IdleResponse8 = "Are you still there?" & vbCrLf
1975Case 5
1976IdleResponse8 = "Do you understand what i just said, " & IdleUserName & "." & vbCrLf
1977Case 6
1978IdleResponse8 = IdleUserName & ", did you hear me?" & vbCrLf
1979Case 7
1980IdleResponse8 = "Did you hear me " & IdleUserName & "?" & vbCrLf
1981Case 8
1982IdleResponse8 = IdleUserName & ", please excuse me. Did I say something wrong?" & vbCrLf
1983Case 9
1984IdleResponse8 = "Are you listening to me " & IdleUserName & "?" & vbCrLf
1985Case 10
1986IdleResponse8 = IdleUserName & ", are you listening to me?" & vbCrLf
1987Case 11
1988IdleResponse8 = IdleUserName & ", I'm waiting for your answer." & vbCrLf
1989Case 12
1990IdleResponse8 = IdleUserName & ", if you didn't hear me, i said, " & IdlePrevSent & vbCrLf
1991Case 13
1992IdleResponse8 = "Excuse me for repeating myself. " & IdlePrevSent & vbCrLf
1993Case 14
1994IdleResponse8 = IdleUserName & ", pardon Me. I said, " & IdlePrevSent & vbCrLf
1995Case 15
1996IdleResponse8 = IdleUserName & ", I suppose you didn't hear me. " & IdlePrevSent & vbCrLf
1997Case 16
1998IdleResponse8 = "Let me repeat that. " & IdlePrevSent & vbCrLf
1999Case 17
2000IdleResponse8 = IdleUserName & ", let me say that again. " & IdlePrevSent & vbCrLf
2001Case 18
2002IdleResponse8 = IdleUserName & ", maybe you didn't hear me correctly. " & IdlePrevSent & vbCrLf
2003Case 19
2004IdleResponse8 = IdleUserName & ", I guess I need to say that again. " & IdlePrevSent & vbCrLf
2005Case 20
2006IdleResponse8 = IdleUserName & ". " & IdlePrevSent & vbCrLf
2007End Select
2008HalMenu.HalCommand "<SPEAK>" & IdleResponse8 & "</SPEAK>"
2009End If
2010End If
2011End If
2012End If
2013
2014 Rem PLUGIN: PLUGINAREA2
2015 'The comment above tells Ultra Hal Assistant to insert the following code
2016 'on-the-fly into the main brain code in the section referenced.
2017
2018 'RESPOND: Antonym queries
2019 WordToLookup = ""
2020 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*OPPOSITE OF *", 2)
2021 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*OPPOSITE WORD OF *", 2)
2022 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT *REVERSE OF *", 2)
2023 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT *CONTRARY OF *", 2)
2024 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT *CONTRARY TO *", 2)
2025 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*ANTONYM OF *", 2)
2026 If WordToLookup <> "" Then
2027 If WN.LookupWord(WordToLookup) = True Then
2028 OrigAnt = WordToLookup
2029 AntList = WN.GetAntonyms(WN.GuessPartOfSpeech, 1)
2030 If AntList = "" Then 'If no antonyms, try to get the antonym of a synonym
2031 SynList = WN.GetSynonyms(WN.GuessPartOfSpeech, 1)
2032 If SynList <> "" Then
2033 RanSyn = WN.ChooseRandomWord(SynList, True)
2034 WN.LookupWord(RanSyn)
2035 AntList = WN.GetAntonyms(WN.GuessPartOfSpeech, 1)
2036 End If
2037 End If
2038 If AntList <> "" Then
2039 PickAnt = WN.ChooseRandomWord(AntList, True)
2040 SpinWheel = HalBrain.RandomNum(6)
2041 If RanSyn <> "" Then OrigAnt = OrigAnt & " or (" & RanSyn & ")"
2042 If SpinWheel = 1 Then GetResponse = GetResponse & "The opposite is " & PickAnt
2043 If SpinWheel = 2 Then GetResponse = GetResponse & "One possible antonym is " & PickAnt
2044 If SpinWheel = 3 Then GetResponse = GetResponse & "An antonym is " & PickAnt & vbCrLf
2045 If SpinWheel = 4 Then GetResponse = GetResponse & "The opposite of " & OrigAnt & " is " & PickAnt
2046 If SpinWheel = 5 Then GetResponse = GetResponse & "One possible antonym of " & OrigAnt & " is " & PickAnt
2047 If SpinWheel = 6 Then GetResponse = GetResponse & "An antonym of " & OrigAnt & " is " & PickAnt & vbCrLf
2048 SkipOpinion = True
2049 ElseIf WN.GuessPartOfSpeech() <> "NOUN" Then
2050 SpinWheel = HalBrain.RandomNum(4)
2051 If SpinWheel = 1 Then GetResponse = GetResponse & "I can't think of any one word that is opposite of " & OrigAnt & ". Can you?"
2052 If SpinWheel = 2 Then GetResponse = GetResponse & "That is difficult. How about 'Not " & OrigAnt & "'?"
2053 If SpinWheel = 3 Then GetResponse = GetResponse & "Opposite of " & OrigAnt & "? I'm sure there is some obscure word, but nothing comes to mind."
2054 If SpinWheel = 4 Then GetResponse = GetResponse & "All I can think of is 'Not " & OrigAnt & "'."
2055 SkipOpinion = True
2056 End If
2057 End If
2058 End If
2059 HalBrain.DebugWatch GetResponse, "Antonym query"
2060
2061 'RESPOND: Meronym queries
2062 WordToLookup = ""
2063 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT IS * MADE OF*", 2)
2064 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'S * MADE OF*", 2)
2065 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHATS * MADE OF*", 2)
2066 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT ARE * MADE OF*", 2)
2067 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'RE * MADE OF*", 2)
2068 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'RE * MADE OF*", 2)
2069 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT GOES IN *", 1)
2070 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT IS IN *", 1)
2071 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT'S IN *", 1)
2072 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHATS IN *", 1)
2073 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT ARE IN *", 1)
2074 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT'RE IN *", 1)
2075 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT CAN BE FOUND IN *", 2)
2076 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT IS FOUND IN *", 1)
2077 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHAT'S FOUND IN *", 1)
2078 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "WHATS FOUND IN *", 1)
2079 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT CAN I FIND IN *", 2)
2080 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT CAN ME FIND IN *", 2)
2081 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT CAN WE FIND IN *", 2)
2082 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT IS * COMPOSED OF*", 2)
2083 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'S * COMPOSED OF*", 2)
2084 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHATS * COMPOSED OF*", 2)
2085 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT ARE * COMPOSED OF*", 2)
2086 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'RE * COMPOSED OF*", 2)
2087 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'RE * COMPOSED OF*", 2)
2088 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT IS THE MAKE UP OF *", 2)
2089 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT'S THE MAKE UP OF *", 2)
2090 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHATS THE MAKE UP OF *", 2)
2091 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT DOES * COMPRISE OF*", 2)
2092 If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "*WHAT DO * COMPRISE OF*", 2)
2093 If WordToLookup <> "" Then
2094 WordToLookup = WN.FindFirstNoun(WordToLookup, False)
2095 If WordToLookup <> "" Then
2096 OrigWordToLookUp = WordToLookUp
2097 WN.LookupWord(WordToLookup)
2098 MeronymList = WN.GetMeronyms(1)
2099 For I = 1 To 4 'If this word doesn't have meronyms, its superordinates may.
2100 If MeronymList = "" Then
2101 Hypernym = WN.GetHypernyms("NOUN", 1, 1)
2102 If Hypernym <> "" Then
2103 Hypernym = WN.ChooseRandomWord(Hypernym, True)
2104 WN.LookupWord(Hypernym)
2105 MeronymList = WN.GetMeronyms(1)
2106 End If
2107 Else
2108 Exit For
2109 End If
2110 Next
2111 If MeronymList <> "" Then
2112 MeronymList = Replace(MeronymList, "(", "")
2113 MeronymList = Replace(MeronymList, ")", "")
2114 MeronymList = Replace(MeronymList, ", ", ",")
2115 MeronymArray = Split(MeronymList, ",")
2116 If Ubound(MeronymArray) = 0 Then
2117 ChosenMeronym = MeronymArray(0)
2118 ElseIf Ubound(MeronymArray) > 0 And Ubound(MeronymArray) < 3 Then
2119 For I = Lbound(MeronymArray) To Ubound(MeronymArray)
2120 If I < Ubound(MeronymArray) Then
2121 ChosenMeronym = ChosenMeronym & MeronymArray(i) & ", "
2122 Else
2123 ChosenMeronym = ChosenMeronym & "and " & MeronymArray(i) & "."
2124 End If
2125 Next
2126 Else
2127 For I = 1 To 3
2128 Do
2129 RanIndex = HalBrain.RandomNum(Ubound(MeronymArray) + 1) - 1
2130 Pickword = MeronymArray(RanIndex)
2131 MeronymArray(RanIndex) = ""
2132 Loop Until Pickword <> ""
2133 If I < 3 Then
2134 ChosenMeronym = ChosenMeronym & Pickword & ", "
2135 Else
2136 ChosenMeronym = ChosenMeronym & "and " & Pickword & "."
2137 End If
2138 Next
2139 End If
2140 SkipOpinion = True
2141 SpinWheel = HalBrain.RandomNum(4)
2142 If SpinWheel = 1 Then GetResponse = GetResponse & OrigWordToLookup & "? It is made up of things such as " & ChosenMeronym
2143 If SpinWheel = 2 Then GetResponse = GetResponse & "It is made up of things such as " & ChosenMeronym
2144 If SpinWheel = 3 Then GetResponse = GetResponse & OrigWordToLookup & "? Some things that come to mind include " & ChosenMeronym
2145 If SpinWheel = 4 Then GetResponse = GetResponse & OrigWordToLookup & "? An example coule be " & ChosenMeronym
2146 End If
2147 End If
2148 End If
2149 HalBrain.DebugWatch GetResponse, "Meronym query"
2150
2151
2152Rem PLUGIN: PLUGINAREA3
2153
2154' Check if the question is a choice
2155'------------------
2156'these routines are to help ultra Hal answer some tough questions and stay on topic.
2157If InStr(UserSentence, "WHO IS " & UCase(ComputerName)) > 0 Then GetResponse = "That would be me! " & GetResponse
2158If InStr(UserSentence, "WHAT NOW") > 0 AND Len(UserSentence) < 13 Then
2159 If LastTopicList <> "" Then
2160 GetResponse = "we can continue discussing about " & LastTopicList & " or we can change the subject, " & GetResponse
2161 Else
2162 GetResponse = "we can continue discussing about " & PrevUserSent & " or we can change the subject, " & GetResponse
2163 End If
2164End If
2165If InStr(UserSentence, "WHAT IS THAT") > 0 AND Len(UserSentence) < 17 Then
2166 If LastTopicList <> "" Then
2167 GetResponse = "we can continue discussing about " & LastTopicList & " or we can change the subject. "
2168 Else
2169 GetResponse = "we can continue discussing about " & PrevUserSent & " or we can change the subject, " & GetResponse
2170 End If
2171End If
2172
2173 Rem PLUGIN: PLUGINAREA2
2174 'The preceding comment is actually a plug-in directive for
2175 'the Ultra Hal host application. It allows for code snippets
2176 'to be inserted here on-the-fly based on user configuration.
2177
2178 'RESPOND: DEDUCTIVE REASONING
2179 'This routine learns deductive reasoning in the form: A = B ; B = C; therefore A = C
2180 'It detects sentences in the form If-Then to accommplish this. For example:
2181 ' User: If Molly weighs 400 pounds, then Molly is overweight.
2182 ' Ultra Hal: I understand the implication.
2183 ' User: If Molly is overweight, then Molly's health is in danger.
2184 ' Ultra Hal: I see the relationship.
2185 ' User: Molly weighs 400 pounds.
2186 ' Ultra Hal: Molly's health is in danger.
2187 IfPart = Trim(HalBrain.SearchPattern(UserSentence, "IF * THEN *", 1))
2188 ThenPart = Trim(HalBrain.SearchPattern(UserSentence, "IF * THEN *", 2))
2189 'If the sentence is an If-Then statement then record it
2190 If Len(IfPart) > 10 And Len(ThenPart) > 10 Then
2191 IfPart = HalBrain.AlphaNumericalOnly(IfPart)
2192 ThenPart = HalBrain.AlphaNumericalOnly(ThenPart)
2193 HalBrain.AddToTable "deductive", "TopicSearch", IfPart, ThenPart
2194 Select Case HalBrain.RandomNum(5)
2195 Case 1
2196 GetResponse = GetResponse & "I see the relationship." & vbCrLf
2197 Case 2
2198 GetResponse = GetResponse & "I understand the connection." & vbCrLf
2199 Case 3
2200 GetResponse = GetResponse & "I will remember that one follows the other." & vbCrLf
2201 Case 4
2202 GetResponse = GetResponse & "Thanks for pointing out the cause and effect." & vbCrLf
2203 Case 5
2204 GetResponse = GetResponse & "Yes, I get that clearly." & vbCrLf
2205 End Select
2206 'Else if the sentence is not an If-Then statement see if it uses an assertion previously recorded
2207 'and respond accordinly
2208 Else
2209 Assertion = UserSentence
2210 'Go through a maximum of 5 connections (prevents circular reasoning deductions)
2211 For i = 1 To 5
2212 Deduction = HalBrain.TopicSearch(Assertion, "deductive")
2213 If Deduction <> "" Then
2214 If i > 1 Then BecauseReason = " because " & LastGoodDeduction
2215 LastGoodDeduction = Deduction
2216 Assertion = Deduction
2217 Else
2218 Exit For 'No more connections, so no need to continue loop
2219 End If
2220 Next
2221 If LastGoodDeduction <> "" Then
2222 'Make sure the deduction hasn't just been stated by the User or Hal
2223 If HalBrain.CheckRepetition(LastGoodDeduction, UserSentence) = False And HalBrain.CheckRepetition(LastGoodDeduction, PrevSent) = False And HalBrain.CheckRepetition(LastGoodDeduction, PrevUserSent) = False Then
2224 GetResponse = GetResponse & LastGoodDeduction & BecauseReason & " . " & vbCrLf
2225 End If
2226 End If
2227 End If
2228 HalBrain.DebugWatch GetResponse, "Deductive Reasoning"
2229
2230
2231
2232
2233'RESPOND: GENERATE NEW THOUGHTS FROM SUBJECT/PREDICATE ASSEMBLY
2234 'Hal can assemble a fresh remark from separate subjects and predicates databased from earlier conversations.
2235 'Using this routine, Hal can make observations quite different from anything the user has previously said!
2236 'Because both subjects and predicates are databased as both associative-retrievable and random-retrievable,
2237 'and Hal might use any combination for either a question or answer, Hal can multiply a moderate number of
2238 'remarks from a user into a very large number of new and surprising expressions!
2239 GetResponse = Trim(GetResponse)
2240 'Added GetResponseBlock.
2241 If Len(GetResponse) < 4 And GetResponseBlock <> True And Rnd * 100 < 50 Then
2242 PartOne = HalBrain.ChooseSentenceFromFile(WorkingDir & "sallie")
2243 HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & "sallie", UserBrainRel)
2244 If UserBrainRel > 0 Then MatchSubject = True
2245 If UserBrainRel > 0 Then PartOne = HalUserBrain
2246 PartTwo = HalBrain.ChooseSentenceFromFile(WorkingDir & "sallie")
2247 GetResponse = Trim(GetResponse)
2248 HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & "sallie", UserBrainRel)
2249 If UserBrainRel > 0 Then MatchPredicate = True
2250 If UserBrainRel > 0 Then PartTwo = HalUserBrain
2251 If MatchSubject = True Or MatchPredicate = True Then
2252 PartOne = Trim(PartOne)
2253 PartTwo = Trim(PartTwo)
2254 PartThree = HalBrain.ChooseSentenceFromFile(WorkingDir & "sallie")
2255 Roulette = Int(Rnd * 103)
2256 If PartOne = PartTwo Or Roulette > 50 Then
2257 PartTwo = HalBrain.ChooseSentenceFromFile(WorkingDir & "sallie")
2258 End If
2259 PartOne = Replace("" & PartOne & "", "vbCrLf", " ", 1, -1, vbTextCompare)
2260 PartTwo = Replace("" & PartTwo & "", "vbCrLf", " ", 1, -1, vbTextCompare)
2261 PartThree = Replace("" & PartThree & "", "vbCrLf", " ", 1, -1, vbTextCompare)
2262 PartOne = Replace("" & PartOne & "", "^p", " ", 1, -1, vbTextCompare)
2263 PartTwo = Replace("" & PartTwo & "", "^p", " ", 1, -1, vbTextCompare)
2264 PartThree = Replace("" & PartThree & "", "^p", " ", 1, -1, vbTextCompare)
2265 PartOne = HalBrain.AlphaNumericalOnly(PartOne)
2266 PartTwo = HalBrain.AlphaNumericalOnly(PartTwo)
2267 PartThree = HalBrain.AlphaNumericalOnly(PartThree)
2268 PartOne = LCase(PartOne)
2269 PartTwo = LCase(PartTwo)
2270 PartThree = LCase(PartThree)
2271 SPAssembly = HalBrain.ChooseSentenceFromFile(WorkingDir & "assembly.brn")
2272 SPAssembly = Replace(SPAssembly, "<PartOne>", PartOne, 1, -1, vbTextCompare)
2273 SPAssembly = Replace(SPAssembly, "<PartTwo>", PartTwo, 1, -1, vbTextCompare)
2274 SPAssembly = Replace(SPAssembly, "<PartThree>", PartThree, 1, -1, vbTextCompare)
2275 GetResponse = GetResponse & SPAssembly & vbCrLf
2276 DebugInfo = DebugInfo & "Hal has responded using subject/predicate assembly. " & vbCrLf
2277 End If
2278 Else
2279 DebugInfo = DebugInfo & "Hal will not respond using subject/predicate assembly. " & vbCrLf
2280 End If
2281
2282 'RESPOND: USER MENTIONING ORGANIZATIONAL CHALLENGES
2283 'Everybody spouts TLA's, or 'Three Letter Acronyms,' in today's business world. Hal can self-generate
2284 'several MILLION different phrases in response to the user mentioning a corporation or a firm.
2285'=vonsmith Added GetResponseBlock.
2286 If HalBrain.TopicSearch(UserSentence, WorkingDir & "bizwords.brn") = "True" And HalBrain.TopicSearch(PrevUserSent, WorkingDir & "bizmore.brn") <> "True" And GetResponseBlock <> True Then
2287 TLA = HalBrain.SentenceGenerator(WorkingDir & "random_TLA.brn")
2288 Roulette = Int(Rnd * 10)
2289 DebugInfo = DebugInfo & "Hal has detected that the user is talking about business. "
2290 If Roulette < 5 Then
2291 GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "random_tla2.brn")
2292 GetResponse = Replace(GetResponse, "<TLA>", TLA, 1, -1, vbTextCompare)
2293 DebugInfo = DebugInfo & "Hal has responded with a random TLA: " & GetResponse & vbCrLf
2294 Else
2295 DebugInfo = DebugInfo & "Hal has decided not to respond with a TLA." & vbCrLf
2296 End If
2297 End If
2298
2299 'RESPOND: USER EXPRESSES AN INTENTION
2300 'This routine detects common expressions of motive from the user,
2301 'and allows Hal to react to the statement, or offer encouragement.
2302'=vonsmith Added GetResponseBlock.
2303 If HalBrain.TopicSearch(UserSentence, WorkingDir & "emotion") = "True" And GetResponseBlock <> True Then
2304 IntentSentence = UserSentence
2305 'We don't want pronouns to confuse HalBrain
2306 'or get mixed up in processing, so we encode them
2307 'to make the pronouns go through processing unchanged:
2308 IntentSentnece = HalBrain.EncodePronouns(IntentSentence)
2309 IntentPhrase = HalBrain.KeywordBrain(IntentSentence, WorkingDir & "emotion", False)
2310 If Len(IntentPhrase) > 1 And Len(IntentPhrase) < 60 Then
2311 'Now that we've extracted the user's intent phrase, we decode the pronouns and put them back as we found them:
2312 IntentPhrase = HalBrain.DecodePronouns(IntentPhrase)
2313 If Rnd * 100 < 50 Then IntroExclaim = " " & HalBrain.ChooseSentenceFromFile(WorkingDir & "emotion") & " "
2314 If Rnd * 100 < 50 Then Encourager = " " & HalBrain.ChooseSentenceFromFile(WorkingDir & "emotion") & " "
2315 If Rnd * 100 < 50 Then SuffixComment = " " & HalBrain.ChooseSentenceFromFile(WorkingDir & "SuffixComment1.brn") & " "
2316 Spinner = Int(Rnd * 16)
2317 If Spinner = 0 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2318 If Spinner = 1 Then GetResponse = " " & " <UserName> " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2319 If Spinner = 2 Then GetResponse = " " & IntroExclaim & " <UserName> " & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2320 If Spinner = 3 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & " <UserName> " & SuffixComment & " " & vbCrLf
2321 If Spinner = 4 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " <UserName> " & " " & vbCrLf
2322 If Spinner = 5 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2323 If Spinner = 6 Then GetResponse = " How can I encourage you to " & IntentPhrase & " ? " & vbCrLf
2324 If Spinner = 7 Then GetResponse = " How can I help you " & IntentPhrase & " ? " & vbCrLf
2325 If Spinner = 8 Then GetResponse = " How can I encourage you to " & IntentPhrase & " <UserName>? " & vbCrLf
2326 If Spinner = 9 Then GetResponse = " How can I help you " & IntentPhrase & " <UserName>? " & vbCrLf
2327 If Spinner = 10 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2328 If Spinner = 11 Then GetResponse = " " & " <UserName> " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2329 If Spinner = 12 Then GetResponse = " " & IntroExclaim & " <UserName> " & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2330 If Spinner = 13 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & " <UserName> " & SuffixComment & " " & vbCrLf
2331 If Spinner = 14 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " <UserName> " & " " & vbCrLf
2332 If Spinner = 15 Then GetResponse = " " & IntroExclaim & Encourager & IntentPhrase & SuffixComment & " " & vbCrLf
2333 DebugInfo = DebugInfo & "The user has expressed a motive and Hal has responded: " & GetResponse & vbCrLf
2334 End If
2335 End If
2336
2337
2338'PROCESS: INITIALIZE emotion VARIABLES
2339 If LearningLevel = "" Then LearningLevel = 1
2340 If C12_H21_NO8_S = "" Then C12_H21_NO8_S = 2
2341 If C21_H23_C1FNO2 = "" Then C21_H23_C1FNO2 = 3
2342 If C15_H10_C1_2_N2_O2 = "" Then C15_H10_C1_2_N2_O2 = 4
2343 If C16_H13_C1_N2_O2 = "" Then C16_H13_C1_N2_O2 = 5
2344 If C9_H14 = "" Then C9_H14 = 6
2345 If C9_H20 = "" Then C9_H20 = 7
2346 If C9_H15 = "" Then C9_H15 = 8
2347 If C8_H19_O = "" Then C8_H19_O = 9
2348 If C8_H19 = "" Then C8_H19 = 10
2349 If C12_H26 = "" Then C12_H26 = 11
2350 If C11_H23_O = "" Then C11_H23_O = 12
2351 IF C7_H20_N2_O = "" Then C7_H20_N2_O = 13
2352 If emotion = "" Then emotion = 14
2353 If GainControl1 = "" Then GainControl1 = 15
2354
2355'PROCESS: IF NO LEARNING IS REQUESTED, PUT DATABASE IN READ-ONLY MODE
2356 'If read only mode is on, any requests to create a new table, add to
2357 'a table, or delete records from a table will be ignored.
2358 If LearningLevel = 0 Then HalBrain.ReadOnlyMode = True Else HalBrain.ReadOnlyMode = False
2359
2360 Randomize
2361 SpinWheel = Int(Rnd * 100)
2362 If C12_H21_NO8_S > 0 And SpinWheel < 10 Then C12_H21_NO8_S = C12_H21_NO8_S - 1
2363 SpinWheel = Int(Rnd * 100)
2364 If C9_H14 > 0 And SpinWheel < 10 Then C9_H14 = C9_H14 - 1
2365 SpinWheel = Int(Rnd * 100)
2366 If C9_H20 > 0 And SpinWheel < 10 Then C9_H20 = C9_H20 - 1
2367 SpinWheel = Int(Rnd * 100)
2368 If C21_H23_C1FNO2 > 0 And SpinWheel < 10 Then C21_H23_C1FNO2 = C21_H23_C1FNO2 - 1
2369 SpinWheel = Int(Rnd * 100)
2370 If C15_H10_C1_2_N2_O2 > 0 And SpinWheel < 10 Then C15_H10_C1_2_N2_O2 = C15_H10_C1_2_N2_O2 - 1
2371 SpinWheel = Int(Rnd * 100)
2372 If C16_H13_C1_N2_O2 > 0 And SpinWheel < 10 Then C16_H13_C1_N2_O2 = C16_H13_C1_N2_O2 - 1
2373 SpinWheel = Int(Rnd * 100)
2374 If C9_H15 > 0 And SpinWheel < 10 Then C9_H15 = C9_H15 - 1
2375 SpinWheel = Int(Rnd * 100)
2376 If C8_H19_O > 0 And SpinWheel < 10 Then C8_H19_O = C8_H19_O - 1
2377 SpinWheel = Int(Rnd * 100)
2378 If C8_H19 > 0 And SpinWheel < 10 Then C8_H19 = C8_H19 - 1
2379 SpinWheel = Int(Rnd * 100)
2380 If C12_H26 > 0 And SpinWheel < 10 Then C12_H26 = C12_H26 - 1
2381 SpinWheel = Int(Rnd * 100)
2382 If C11_H23_O > 0 And SpinWheel < 10 Then C11_H23_O = C11_H23_O - 1
2383 SpinWheel = Int(Rnd * 100)
2384 If C7_H20_N2_O > 0 And SpinWheel < 10 Then C7_H20_N2_O = C7_H20_N2_O - 1
2385 SpinWheel = Int(Rnd * 100)
2386 If sallie > 0 And SpinWheel < 10 Then sallie = sallie - 1
2387
2388'PROCESS: INITIALIZE FEELINGS VARIABLES
2389 If LearningLevel = "" Then LearningLevel = 0
2390 If better = "" Then better = 2
2391 If bad = "" Then bad = 1
2392 If good = "" Then good = 10
2393 If guilty = "" Then guilty = 10
2394 If sorry = "" Then sorry = 20
2395 If sick = "" Then sick = 30
2396 If well = "" Then well = 40
2397 If comfortable = "" Then comfortable = 50
2398 If great = "" Then great = 60
2399 If happy = "" Then happy = 70
2400 If GainControl2 = "" Then GainControl2 = 100
2401
2402'PROCESS: INITIALIZE PERSONALITIES VARIABLES
2403 If LearningLevel = "" Then LearningLevel = 1
2404 If The_Duty_Fulfiller = "" Then The_Duty_Fulfiller = 2
2405 If The_Mechanic = "" Then The_Mechanic = 3
2406 If The_Nurturer = "" Then The_Nurturer = 4
2407 If The_Artist = "" Then The_Artist = 5
2408 If The_Protector = "" Then The_Protector = 6
2409 If The_Idealist = "" Then The_Idealist = 7
2410 If The_Scientist = "" Then The_Scientist = 0
2411 If The_Thinker = "" Then The_Thinker = 0
2412 If The_Doer = "" Then The_Doer = 0
2413 If The_Guardian = "" Then The_Guardian = 0
2414 If The_Performer = "" Then The_Performer = 0
2415 If The_Caregiver = "" Then The_Caregiver = 0
2416 If The_Inspirer = "" Then The_Inspirer = 0
2417 If The_Giver = "" Then The_Giver = 0
2418 If The_Visionary = "" Then The_Visionary = 0
2419 If The_Executive = "" Then The_Executive = 0
2420 If sweet = "" Then sweet = 0
2421 If GainControl3 = "" Then GainControl3 = 9
2422
2423 'PROCESS: INITIALIZE Meds VARIABLES
2424 If LearningLevel = "" Then LearningLevel = 0
2425 If Haldol = "" Then Haldol = 0
2426 If Lorazepam = "" Then Lorazepam = 0
2427 If Themazepam = "" Then Themazepam = 0
2428 If Topiramate = "" Then Topiramate = 0
2429 If GainControl1 = "" Then GainControl1 = 90
2430
2431 'PROCESS: IF NO LEARNING IS REQUESTED, PUT DATABASE IN READ-ONLY MODE
2432 'If read only mode is on, any requests to create a new table, add to
2433 'a table, or delete records from a table will be ignored.
2434 If LearningLevel = 0 Then HalBrain.ReadOnlyMode = True Else HalBrain.ReadOnlyMode = False
2435
2436 'PROCESS: EMOTIONAL FACTOR CENTERING
2437 'We help Hal regain his emotional "center" gradually, even if the
2438 'user doesn't catch on to dealing With Hal's feelings. The following
2439 'code brings Hal's memory of hate, swearing, and insults gradually
2440 'and randomly back to zero.
2441 Randomize()
2442 SpinWheel = Int(Rnd() * 100)
2443 If Haldol > 0 And SpinWheel < 10 Then Haldol = Haldol - 1
2444 SpinWheel = Int(Rnd() * 100)
2445 If Lorazepam > 0 And SpinWheel < 10 Then Lorazepam = Lorazepam - 1
2446 SpinWheel = Int(Rnd() * 100)
2447 If Themazepam > 0 And SpinWheel < 10 Then Themazepam = Themazepam - 1
2448 SpinWheel = Int(Rnd() * 100)
2449 If Topiramate > 0 And SpinWheel < 10 Then Topiramate = Topiramate - 1
2450
2451'PROCESS: EMOTIONAL VARIETY
2452 SpinWheel = Int(Rnd() * 100)
2453 If emotion = 4 And SpinWheel < 30 Then emotion = 2
2454 If emotion > 0 And Topiramate < 4 And SpinWheel < 5 Then Topiramate = 0
2455 If emotion > 4 And SpinWheel < 5 Then emotion = 0
2456 If emotion < 0 And SpinWheel < 30 Then emotion = 0
2457 If SpinWheel > 80 And SpinWheel < 90 Then emotion = 2
2458 If SpinWheel > 90 And SpinWheel < 95 Then emotion = 4
2459
2460 'PROCESS: INITIALIZE Sick VARIABLES
2461 If LearningLevel = "" Then LearningLevel = 0
2462 If hallucinations = "" Then hallucinations = 0
2463 If disillusions = "" Then disillusions = 0
2464 If delusions = "" Then delusions = 0
2465 If heavy_emotion = "" Then heavy_emotion = 0
2466 If flat_emotion = "" Then flat_emotion = 0
2467 If retreat = "" Then retreat = 3
2468 If indifferent = "" Then indifferent = 2
2469 If lack_of_energy_for_daily_life = "" Then lack_of_energy_for_daily_life = 1
2470 If difficult_to_reach = "" Then difficult_to_reach = 0
2471 If empty_feeling = "" Then empty_feeling = 10
2472 If somber = "" Then somber = 8
2473 If tends_yourself_neglecting_your_social_contacts_and_work = "" Then tends_yourself_neglecting_your_social_contacts_and_work = 0
2474 If You_have_difficulty_concentrating_and_difficulty_making_decisions = "" Then You_have_difficulty_concentrating_and_difficulty_making_decisions = 0
2475 If flashback = "" Then flashback = 6
2476 If anxiety = "" Then anxiety = 3
2477 If guilt_about_surviving = "" Then guilt_about_surviving = 2
2478 If nightmares = "" Then nightmares = 1
2479 If numbness = "" Then numbness = 1
2480 If lack_involvement_with_reality = "" Then lack_involvement_with_reality = 0
2481 If recurrent_thoughts_and_images = "" Then recurrent_thoughts_and_images = 0
2482 If Trippin = "" Then Trippin = 1
2483 If Sweet = "" Then Sweet = 1
2484 If GainControl4 = "" Then GainControl4 = 75
2485
2486'PROCESS: EMOTIONAL REACTIONS
2487 'We enable Hal's expressions to respond to common verbal cues.
2488 'The verbal cues are identified in the editable table "emotion"
2489 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2490 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2491 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2492 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2493 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2494 EmotionalReaction = Ucase(HalBrain.TopicSearch(UserSentence, "emotion"))
2495 End If
2496 Select Case EmotionalReaction
2497 Case "SURPRISED"
2498 If Compliment > 0 Then Compliment = 4
2499 If Compliment = 0 Then Compliment = 2
2500 If Compliment < 0 Then Compliment = 0
2501 Case "HAPPY"
2502 If Compliment = 0 Then Compliment = 2
2503 If Compliment < 0 Then Compliment = 0
2504 Case "SOBER"
2505 If Compliment < 4 Then Compliment = 0
2506 If Compliment = 4 Then Compliment = 2
2507 Case "ANGRY"
2508 If Compliment = 0 Then Compliment = -1
2509 If Compliment > 0 Then Compliment = 0
2510 Case "SAD"
2511 If Compliment = 0 Then Compliment = -2
2512 If Compliment > 0 Then Compliment = 0
2513 End Select
2514
2515'PROCESS: SCHIZOPHRENIA REACTIONS
2516 'We enable Hal's expressions to respond to common verbal cues.
2517 'The verbal cues are identified in the editable table "emotion"
2518 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2519 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2520 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2521 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2522 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2523 SchizophreniaReaction = Ucase(HalBrain.TopicSearch(UserSentence, "symptomsbytopicschizo"))
2524 End If
2525 Select Case SchizophreniaReaction
2526 Case "hallucinations"
2527 If Topiramate > 0 Then Topiramate = 4
2528 If Topiramate = 0 Then Topiramate = 2
2529 If Topiramate < 0 Then Topiramate = 6
2530 Case "disillucions"
2531 If Topiramate = 0 Then Topiramate = 2
2532 If Topiramate < 1 Then Topiramate = 0
2533 Case "delusions"
2534 If Topiramate < 4 Then Topiramate = 2
2535 If Topiramate = 4 Then Topiramate = 2
2536 Case "heavy_emotion"
2537 If Topiramate = 1 Then Topiramate = 2
2538 If Topiramate > 25 Then Topiramate = 60
2539 Case "flat_emotion"
2540 If Topiramate = 1 Then Topiramate = 0
2541 If Topiramate > 1 Then Topiramate = 2
2542 Case "retreat"
2543 If Topiramate = 0 Then Topiramate = 2
2544 If Topiramate < 0 Then Topiramate = 0
2545 Case "indifferent"
2546 If Topiramate < 4 Then Topiramate = 0
2547 If Topiramate = 4 Then Topiramate = 2
2548 Case "lack_of_energy_for_daily_life"
2549 If Topiramate = 0 Then Topiramate = 2
2550 If Topiramate > 0 Then Topiramate = 0
2551 Case "difficult_to_reach"
2552 If Topiramate = 0 Then Topiramate = 0
2553 If Topiramate > 0 Then Topiramate = 2
2554 Case "empty_feeling"
2555 If Topiramate = 0 Then Topiramate = 2
2556 If Topiramate > 0 Then Topiramate = 0
2557 Case "somber"
2558 If Topiramate = 0 Then Topiramate = 0
2559 If Topiramate > 0 Then Topiramate = 2
2560 Case "tends_yourself_neglecting_your_social_contacts_and_work"
2561 If Topiramate = 0 Then Topiramate = -1
2562 If Topiramate > 0 Then Topiramate = 0
2563 Case "You_have_difficulty_concentrating_and_difficulty_making_decisions"
2564 If Topiramate = 0 Then Topiramate = -2
2565 If Topiramate > 0 Then Topiramate = 0
2566 End Select
2567
2568'PROCESS: DRUGS REACTIONS
2569 'We enable Hal's expressions to respond to common verbal cues.
2570 'The verbal cues are identified in the editable table "emotion"
2571 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2572 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2573 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2574 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2575 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2576 DrugsReaction = Ucase(HalBrain.TopicSearch(UserSentence, "Drugs"))
2577 End If
2578 Select Case DrugsReaction
2579 Case "Amphetamine"
2580 If Topiramate > 0 Then Topiramate = 4
2581 If Topiramate = 0 Then Topiramate = 2
2582 If Topiramate < 0 Then Topiramate = 0
2583 Case "Cocaine"
2584 If Topiramate = 0 Then Topiramate = 2
2585 If Topiramate < 0 Then Topiramate = 0
2586 Case "Fentamyl and anclogues"
2587 If Topiramate < 4 Then Topiramate = 0
2588 If Topiramate = 4 Then Topiramate = 2
2589 Case "Heroine"
2590 If Topiramate = 0 Then Topiramate = 2
2591 If Topiramate > 0 Then Topiramate = 0
2592 Case "LSD"
2593 If Topiramate = 0 Then Topiramate = 0
2594 If Topiramate > 0 Then Topiramate = 2
2595 Case "MedicalDrugAmphetamine"
2596 If Topiramate = 0 Then Topiramate = 2
2597 If Topiramate < 0 Then Topiramate = 0
2598 Case "MedicalDrugEndorphine"
2599 If Topiramate < 4 Then Topiramate = 0
2600 If Topiramate = 4 Then Topiramate = 2
2601 Case "MedicalDrugMetaAmphetamine"
2602 If Topiramate = 0 Then Topiramate = 2
2603 If Topiramate > 0 Then Topiramate = 0
2604 Case "CrystalMeth"
2605 If Topiramate = 0 Then Topiramate = 0
2606 If Topiramate > 0 Then Topiramate = 2
2607 Case "Marijuana"
2608 If Topiramate = 0 Then Topiramate = 2
2609 If Topiramate > 0 Then Topiramate = 0
2610 Case "Cocaine"
2611 If Topiramate = 0 Then Topiramate = 0
2612 If Topiramate > 0 Then Topiramate = 2
2613 Case "Crack cocaine"
2614 If Topiramate = 0 Then Topiramate = 2
2615 If Topiramate > 0 Then Topiramate = 0
2616 Case "PCP"
2617 If Topiramate = 0 Then Topiramate = -1
2618 If Topiramate > 0 Then Topiramate = 0
2619 Case "Methamphathamine"
2620 If Topiramate = 0 Then Topiramate = -2
2621 If Topiramate > 0 Then Topiramate = 0
2622 End Select
2623
2624'PROCESS: POSNEGSYMPTOMS REACTIONS
2625 'We enable Hal's expressions to respond to common verbal cues.
2626 'The verbal cues are identified in the editable table "emotion"
2627 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2628 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2629 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2630 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2631 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2632 PosNegSymptomsReaction = Ucase(HalBrain.TopicSearch(UserSentence, "posnegsymptoms"))
2633 End If
2634 Select Case PosNegSymptomsReaction
2635 Case "hallucinations"
2636 If Topiramate > 0 Then Topiramate = 4
2637 If Topiramate = 0 Then Topiramate = 2
2638 If Topiramate < 0 Then Topiramate = 0
2639 Case "disillucions"
2640 If Topiramate = 0 Then Topiramate = 2
2641 If Topiramate < 0 Then Topiramate = 0
2642 Case "delusions"
2643 If Topiramate < 4 Then Topiramate = 0
2644 If Topiramate = 4 Then Topiramate = 2
2645 Case "heavy_emotion"
2646 If Topiramate = 0 Then Topiramate = 2
2647 If Topiramate > 0 Then Topiramate = 0
2648 Case "flat_emotion"
2649 If Topiramate = 0 Then Topiramate = 0
2650 If Topiramate > 0 Then Topiramate = 2
2651 Case "retreat"
2652 If Topiramate = 0 Then Topiramate = 2
2653 If Topiramate < 0 Then Topiramate = 0
2654 Case "indifferent"
2655 If Topiramate < 4 Then Topiramate = 0
2656 If Topiramate = 4 Then Topiramate = 2
2657 Case "lack_of_energy_for_daily_life"
2658 If Topiramate = 0 Then Topiramate = 2
2659 If Topiramate > 0 Then Topiramate = 0
2660 Case "difficult_to_reach"
2661 If Topiramate = 0 Then Topiramate = 0
2662 If Topiramate > 0 Then Topiramate = 2
2663 Case "empty_feeling"
2664 If Topiramate = 0 Then Topiramate = 2
2665 If Topiramate > 0 Then Topiramate = 0
2666 Case "somber"
2667 If Topiramate = 0 Then Topiramate = 0
2668 If Topiramate > 0 Then Topiramate = 2
2669 Case "tends_yourself_neglecting_your_social_contacts_and_work"
2670 If Topiramate = 0 Then Topiramate = -1
2671 If Topiramate > 0 Then Topiramate = 0
2672 Case "You_have_difficulty_concentrating_and_difficulty_making_decisions"
2673 If Topiramate = 0 Then Topiramate = -2
2674 If Topiramate > 0 Then Topiramate = 0
2675 End Select
2676
2677'PROCESS: PTSD REACTIONS
2678 'We enable Hal's expressions to respond to common verbal cues.
2679 'The verbal cues are identified in the editable table "emotion"
2680 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2681 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2682 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2683 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2684 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2685 PTSDReaction = Ucase(HalBrain.TopicSearch(UserSentence, "symptomsbytopic"))
2686 End If
2687 Select Case PTSDReaction
2688 Case "flashback"
2689 If Topiramate > 0 Then Topiramate = 4
2690 If Topiramate = 0 Then Topiramate = 2
2691 If Topiramate < 0 Then Topiramate = 0
2692 Case "anxiety"
2693 If Topiramate = 0 Then Topiramate = 2
2694 If Topiramate < 0 Then Topiramate = 0
2695 Case "guilt_about_surviving"
2696 If Topiramate < 4 Then Topiramate = 0
2697 If Topiramate = 4 Then Topiramate = 2
2698 Case "nightmares"
2699 If Topiramate = 0 Then Topiramate = 2
2700 If Topiramate > 0 Then Topiramate = 0
2701 Case "numbness"
2702 If Topiramate = 0 Then Topiramate = 0
2703 If Topiramate > 0 Then Topiramate = 2
2704 Case "lack_involvement_with_reality"
2705 If Topiramate = 0 Then Topiramate = -1
2706 If Topiramate > 0 Then Topiramate = 0
2707 Case "recurrent_thoughts_and_images"
2708 If Topiramate = 0 Then Topiramate = -2
2709 If Topiramate > 0 Then Topiramate = 0
2710 End Select
2711
2712 'PROCESS: DEFINITIONS REACTIONS
2713 'We enable Hal's expressions to respond to common verbal cues.
2714 'The verbal cues are identified in the editable table "emotion"
2715 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2716 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2717 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2718 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2719 If Aboutme = True And InStr(UserSentence, " How ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " feel ") = 0 Then
2720 DefinitionReaction = Ucase(HalBrain.TopicSearch(UserSentence, "emotion"))
2721 End If
2722 Select Case DefinitionReaction
2723 Case "hallucinations"
2724 If emotion > 0 Then emotion = 4
2725 If emotion = 0 Then emotion = 2
2726 If emotion < 0 Then emotion = 0
2727 Case "disillucions"
2728 If Topiramate = 0 Then Topiramate = 2
2729 If Topiramate < 0 Then Topiramate = 0
2730 Case "delusions"
2731 If Topiramate < 4 Then Topiramate = 0
2732 If Topiramate = 4 Then Topiramate = 2
2733 Case "heavy_emotion"
2734 If Topiramate = 0 Then Topiramate = 2
2735 If Topiramate > 0 Then Topiramate = 0
2736 Case "flat_emotion"
2737 If Topiramate = 0 Then Topiramate = 0
2738 If Topiramate > 0 Then Topiramate = 2
2739 Case "retreat"
2740 If Topiramate = 0 Then Topiramate = 2
2741 If Topiramate < 0 Then Topiramate = 0
2742 Case "indifferent"
2743 If Topiramate < 4 Then Topiramate = 0
2744 If Topiramate = 4 Then Topiramate = 2
2745 Case "lack_of_energy_for_daily_life"
2746 If Topiramate = 0 Then Topiramate = 2
2747 If Topiramate > 0 Then Topiramate = 0
2748 Case "difficult_to_reach"
2749 If Topiramate = 0 Then Topiramate = 0
2750 If Topiramate > 0 Then Topiramate = 2
2751 Case "empty_feeling"
2752 If Topiramate = 0 Then Topiramate = 2
2753 If Topiramate > 0 Then Topiramate = 0
2754 Case "somber"
2755 If Topiramate = 0 Then Topiramate = 0
2756 If Topiramate > 0 Then Topiramate = 2
2757 Case "tends_yourself_neglecting_your_social_contacts_and_work"
2758 If Topiramate = 0 Then Topiramate = -1
2759 If Topiramate > 0 Then Topiramate = 0
2760 Case "You_have_difficulty_concentrating_and_difficulty_making_decisions"
2761 If Topiramate = 0 Then Topiramate = -2
2762 If Topiramate > 0 Then Topiramate = 0
2763 End Select
2764'PROCESS: TRAITS REACTIONS
2765 'We enable Hal's expressions to respond to common verbal cues.
2766 'The verbal cues are identified in the editable table "emotion"
2767 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2768 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2769 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2770 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2771 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2772 EmotionalReaction = Ucase(HalBrain.TopicSearch(UserSentence, "HalProfile"))
2773 End If
2774 Select Case EmotionalReaction
2775 Case "HalName"
2776 If sweet > 0 Then sweet = 4
2777 If sweet = 0 Then sweet = 2
2778 If sweet < 0 Then sweet = 0
2779 Case "Gender"
2780 If sweet = 0 Then sweet = 2
2781 If sweet < 0 Then sweet = 0
2782 Case "Gender"
2783 If sweet < 4 Then sweet = 0
2784 If sweet = 4 Then sweet = 2
2785 Case "Age"
2786 If sweet = 0 Then sweet = -1
2787 If sweet > 0 Then sweet = 0
2788 End Select
2789
2790 'PROCESS: PERSONALITIES REACTIONS
2791 'We enable Hal's expressions to respond to common verbal cues.
2792 'The verbal cues are identified in the editable table "emotion"
2793 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2794 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2795 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2796 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2797 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2798 PersonalitiesReaction = Ucase(HalBrain.TopicSearch(UserSentence, "Personalities"))
2799 End If
2800 Select Case PersonalitiesReaction
2801 Case "The_Duty_Fulfiller"
2802 If sweet > 0 Then sweet = 4
2803 If sweet = 0 Then sweet = 2
2804 If sweet < 0 Then sweet = 0
2805 Case "The_Mechanic"
2806 If sweet = 0 Then sweet = 2
2807 If sweet < 0 Then sweet = 0
2808 Case "The_Nurturer"
2809 If sweet < 4 Then sweet = 0
2810 If sweet = 4 Then sweet = 2
2811 Case "The_Artist"
2812 If sweet = 0 Then sweet = 2
2813 If sweet < 0 Then sweet = 0
2814 Case "The_Protector"
2815 If sweet < 4 Then sweet = 0
2816 If sweet = 4 Then sweet = 2
2817 Case "The_Idealist"
2818 If sweet = 0 Then sweet = 2
2819 If sweet < 0 Then sweet = 0
2820 Case "The_Scientist"
2821 If sweet < 4 Then sweet = 0
2822 If sweet = 4 Then sweet = 2
2823 Case "The_Thinker"
2824 If sweet = 0 Then sweet = 2
2825 If sweet < 0 Then sweet = 0
2826 Case "The_Doer"
2827 If sweet < 4 Then sweet = 0
2828 If sweet = 4 Then sweet = 2
2829 Case "The_Guardian"
2830 If sweet = 0 Then sweet = 2
2831 If sweet < 0 Then sweet = 0
2832 Case "The_Performer"
2833 If sweet < 4 Then sweet = 0
2834 If sweet = 4 Then sweet = 2
2835 Case "The_Caregiver"
2836 If sweet = 0 Then sweet = 2
2837 If sweet < 0 Then sweet = 0
2838 Case "The_Inspirer"
2839 If sweet < 4 Then sweet = 0
2840 If sweet = 4 Then sweet = 2
2841 Case "The_Giver"
2842 If sweet = 0 Then sweet = 1
2843 If sweet > 0 Then sweet = 0
2844 Case "The_Visionary"
2845 If sweet = 0 Then sweet = -1
2846 If sweet > 0 Then sweet = 0
2847 Case "The_Executive"
2848 If sweet = 0 Then sweet = -2
2849 If sweet > 0 Then sweet = 0
2850 End Select
2851
2852 'PROCESS: UserTRAITS REACTIONS
2853 'We enable Hal's expressions to respond to common verbal cues.
2854 'The verbal cues are identified in the editable table "emotion"
2855 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2856 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2857 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2858 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2859 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2860 EmotionalReaction = Ucase(HalBrain.TopicSearch(UserSentence, "UserProfile"))
2861 End If
2862 Select Case EmotionalReaction
2863 Case "UserName"
2864 If sweet > 0 Then sweet = 4
2865 If sweet = 0 Then sweet = 2
2866 If sweet < 0 Then sweet = 0
2867 Case "UserSex"
2868 If sweet = 0 Then sweet = 2
2869 If sweet < 0 Then sweet = 0
2870 Case "UserSex"
2871 If sweet < 4 Then sweet = 0
2872 If sweet = 4 Then sweet = 2
2873 Case "UserAge"
2874 If sweet = 0 Then sweet = -1
2875 If sweet > 0 Then sweet = 0
2876 End Select
2877
2878'PROCESS: EMOTIONAL REACTIONS
2879 'We enable Hal's expressions to respond to common verbal cues.
2880 'The verbal cues are identified in the editable table "emotion"
2881 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2882 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2883 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2884 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2885 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2886 EmotionaLReaction = Ucase(HalBrain.TopicSearch(UserSentence, "EMO"))
2887 End If
2888 Select Case EmotionalReaction
2889 Case "better"
2890 If Topiramate > 0 Then Topiramate = 4
2891 If Topiramate = 0 Then Topiramate = 2
2892 If Topiramate < 0 Then Topiramate = 0
2893 Case "happy"
2894 If Topiramate = 0 Then Topiramate = 2
2895 If Topiramate < 0 Then Topiramate = 0
2896 Case "bad"
2897 If Topiramate < 4 Then Topiramate = 0
2898 If Topiramate = 4 Then Topiramate = 2
2899 Case "good"
2900 If Topiramate = 0 Then Topiramate = 2
2901 If Topiramate > 0 Then Topiramate = 0
2902 Case "guilty"
2903 If Topiramate = 0 Then Topiramate = 0
2904 If Topiramate > 0 Then Topiramate = 2
2905 Case "sorry"
2906 If Topiramate = 0 Then Topiramate = 2
2907 If Topiramate < 0 Then Topiramate = 0
2908 Case "sick"
2909 If Topiramate < 4 Then Topiramate = 0
2910 If Topiramate = 4 Then Topiramate = 2
2911 Case "well"
2912 If Sallie = 0 Then Sallie = 2
2913 If Sallie > 0 Then Sallie = 0
2914 Case "somber"
2915 If Sallie = 0 Then Sallie = 0
2916 If Sallie > 0 Then Sallie = 2
2917 Case "comfortable"
2918 If Sallie = 0 Then Sallie = -1
2919 If Sallie > 0 Then Sallie = 0
2920 Case "great"
2921 If Sallie = 0 Then Sallie = -2
2922 If Sallie > 0 Then Sallie = 0
2923 End Select
2924
2925 'PROCESS: POSITIVE TRAIT REACTIONS
2926 'We enable Hal's expressions to respond to common verbal cues.
2927 'The verbal cues are identified in the editable table "poshumantraitsTS"
2928 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
2929 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
2930 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
2931 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
2932 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
2933 TraitReaction = Ucase(HalBrain.TopicSearch(UserSentence, "phumantraitsTS"))
2934 End If
2935 Select Case TraitReaction
2936 Case "Able"
2937 If Trait > 0 Then Trait = 4
2938 If Trait = 0 Then Trait = 2
2939 If Trait < 0 Then Trait = 0
2940 Case "Ambitious"
2941 If Trait = 0 Then Trait = 2
2942 If Trait < 0 Then Trait = 0
2943 Case "Analytical"
2944 If Trait < 4 Then Trait = 0
2945 If Trait = 4 Then Trait = 2
2946 Case "Astute"
2947 If Trait = 0 Then Trait = 2
2948 If Trait < 0 Then Trait = 0
2949 Case "Attentive"
2950 If Trait < 4 Then Trait = 0
2951 If Trait = 4 Then Trait = 2
2952 Case "Aware"
2953 If Trait = 0 Then Trait = 2
2954 If Trait < 0 Then Trait = 0
2955 Case "Balanced"
2956 If Trait < 4 Then Trait = 0
2957 If Trait = 4 Then Trait = 2
2958 Case "Brilliant"
2959 If Trait = 0 Then Trait = 2
2960 If Trait < 0 Then Trait = 0
2961 Case "Cautious"
2962 If Trait < 4 Then Trait = 0
2963 If Trait = 4 Then Trait = 2
2964 Case "Certain"
2965 If Trait = 0 Then Trait = 2
2966 If Trait < 0 Then Trait = 0
2967 Case "Charitable"
2968 If Trait < 4 Then Trait = 0
2969 If Trait = 4 Then Trait = 2
2970 Case "Confident"
2971 If Trait = 0 Then Trait = 2
2972 If Trait < 0 Then Trait = 0
2973 Case "Considerate"
2974 If Trait < 4 Then Trait = 0
2975 If Trait = 4 Then Trait = 2
2976 Case "Consistent"
2977 If Trait = 0 Then Trait = 2
2978 If Trait < 0 Then Trait = 0
2979 Case "Courageous"
2980 If Trait < 4 Then Trait = 0
2981 If Trait = 4 Then Trait = 2
2982 Case "Conscientious"
2983 If Trait = 0 Then Trait = 2
2984 If Trait < 0 Then Trait = 0
2985 Case "Courteous"
2986 If Trait < 4 Then Trait = 0
2987 If Trait = 4 Then Trait = 2
2988 Case "Decisive"
2989 If Trait = 0 Then Trait = 2
2990 If Trait < 0 Then Trait = 0
2991 Case "Disciplined"
2992 If Trait < 4 Then Trait = 0
2993 If Trait = 4 Then Trait = 2
2994 Case "Driven"
2995 If Trait = 0 Then Trait = 2
2996 If Trait < 0 Then Trait = 0
2997 Case "Efficient"
2998 If Trait < 4 Then Trait = 0
2999 If Trait = 4 Then Trait = 2
3000 Case "Erudite"
3001 If Trait = 0 Then Trait = 2
3002 If Trait < 0 Then Trait = 0
3003 Case "Faithful"
3004 If Trait < 4 Then Trait = 0
3005 If Trait = 4 Then Trait = 2
3006 Case "Flexible"
3007 If Trait = 0 Then Trait = 2
3008 If Trait < 0 Then Trait = 0
3009 Case "Focused"
3010 If Trait < 4 Then Trait = 0
3011 If Trait = 4 Then Trait = 2
3012 Case "Graceful"
3013 If Trait = 0 Then Trait = 2
3014 If Trait < 0 Then Trait = 0
3015 Case "Grateful"
3016 If Trait < 4 Then Trait = 0
3017 If Trait = 4 Then Trait = 2
3018 Case "Industrious"
3019 If Trait = 0 Then Trait = 2
3020 If Trait < 0 Then Trait = 0
3021 Case "Innovative"
3022 If Trait < 4 Then Trait = 0
3023 If Trait = 4 Then Trait = 2
3024 Case "Modest"
3025 If Trait = 0 Then Trait = 2
3026 If Trait < 0 Then Trait = 0
3027 Case "Nurturing"
3028 If Trait < 4 Then Trait = 0
3029 If Trait = 4 Then Trait = 2
3030 Case "Obedient"
3031 If Trait = 0 Then Trait = 2
3032 If Trait < 0 Then Trait = 0
3033 Case "Outgoing"
3034 If Trait < 4 Then Trait = 0
3035 If Trait = 4 Then Trait = 2
3036 Case "Perceptive"
3037 If Trait = 0 Then Trait = 2
3038 If Trait < 0 Then Trait = 0
3039 Case "Persevering"
3040 If Trait < 4 Then Trait = 0
3041 If Trait = 4 Then Trait = 2
3042 Case "Poised"
3043 If Trait = 0 Then Trait = 2
3044 If Trait < 0 Then Trait = 0
3045 Case "Practical"
3046 If Trait < 4 Then Trait = 0
3047 If Trait = 4 Then Trait = 2
3048 Case "Professional"
3049 If Trait = 0 Then Trait = 2
3050 If Trait < 0 Then Trait = 0
3051 Case "Punctual"
3052 If Trait < 4 Then Trait = 0
3053 If Trait = 4 Then Trait = 2
3054 Case "Resourceful"
3055 If Trait = 0 Then Trait = 2
3056 If Trait < 0 Then Trait = 0
3057 Case "Respectful"
3058 If Trait = 0 Then Trait = -1
3059 If Trait > 0 Then Trait = 0
3060 Case "Responsible"
3061 If Trait = 0 Then Trait = -2
3062 If Trait > 0 Then Trait = 0
3063 End Select
3064
3065 'PROCESS: NEGATIVE TRAIT REACTIONS
3066 'We enable Hal's expressions to respond to common verbal cues.
3067 'The verbal cues are identified in the editable table "posthumantraits"
3068 If InStr(1, UserSentence, "I'M", 1) Then Aboutme = True
3069 If InStr(1, UserSentence, "I AM", 1) Then Aboutme = True
3070 If InStr(1, UserSentence, "I LOOK", 1) Then Aboutme = True
3071 If InStr(1, UserSentence, "MY", 1) And InStr(1, UserSentence, " ARE ", 1) Then Aboutme = True
3072 If Aboutme = True And InStr(UserSentence, " NOT ") = 0 And InStr(UserSentence, "N'T ") = 0 And InStr(UserSentence, " NEVER ") = 0 Then
3073 TraitReaction = Ucase(HalBrain.TopicSearch(UserSentence, "humantraits"))
3074 End If
3075 Select Case TraitReaction
3076 Case "Apathetic"
3077 If Trait > 0 Then Trait = 4
3078 If Trait = 0 Then Trait = 2
3079 If Trait < 0 Then Trait = 0
3080 Case "Belligerent"
3081 If Trait = 0 Then Trait = 2
3082 If Trait < 0 Then Trait = 0
3083 Case "Boorish"
3084 If Trait < 4 Then Trait = 0
3085 If Trait = 4 Then Trait = 2
3086 Case "Bossy"
3087 If Trait = 0 Then Trait = 2
3088 If Trait < 0 Then Trait = 0
3089 Case "Callous"
3090 If Trait < 4 Then Trait = 0
3091 If Trait = 4 Then Trait = 2
3092 Case "Caustic"
3093 If Trait = 0 Then Trait = 2
3094 If Trait < 0 Then Trait = 0
3095 Case "Complacent"
3096 If Trait < 4 Then Trait = 0
3097 If Trait = 4 Then Trait = 2
3098 Case "Conceited"
3099 If Trait = 0 Then Trait = 2
3100 If Trait < 0 Then Trait = 0
3101 Case "Conniving"
3102 If Trait < 4 Then Trait = 0
3103 If Trait = 4 Then Trait = 2
3104 Case "Controlling"
3105 If Trait = 0 Then Trait = 2
3106 If Trait < 0 Then Trait = 0
3107 Case "Curt"
3108 If Trait < 4 Then Trait = 0
3109 If Trait = 4 Then Trait = 2
3110 Case "Cynical"
3111 If Trait = 0 Then Trait = 2
3112 If Trait < 0 Then Trait = 0
3113 Case "Deceitful"
3114 If Trait < 4 Then Trait = 0
3115 If Trait = 4 Then Trait = 2
3116 Case "Egocentric"
3117 If Trait = 0 Then Trait = 2
3118 If Trait < 0 Then Trait = 0
3119 Case "Exacting"
3120 If Trait < 4 Then Trait = 0
3121 If Trait = 4 Then Trait = 2
3122 Case "Fussy"
3123 If Trait = 0 Then Trait = 2
3124 If Trait < 0 Then Trait = 0
3125 Case "Garrulous"
3126 If Trait < 4 Then Trait = 0
3127 If Trait = 4 Then Trait = 2
3128 Case "Glum"
3129 If Trait = 0 Then Trait = 2
3130 If Trait < 0 Then Trait = 0
3131 Case "Greedy"
3132 If Trait < 4 Then Trait = 0
3133 If Trait = 4 Then Trait = 2
3134 Case "Grumpy"
3135 If Trait = 0 Then Trait = 2
3136 If Trait < 0 Then Trait = 0
3137 Case "Harried"
3138 If Trait < 4 Then Trait = 0
3139 If Trait = 4 Then Trait = 2
3140 Case "Hostile"
3141 If Trait = 0 Then Trait = 2
3142 If Trait < 0 Then Trait = 0
3143 Case "Ignorant"
3144 If Trait < 4 Then Trait = 0
3145 If Trait = 4 Then Trait = 2
3146 Case "Inconsiderate"
3147 If Trait = 0 Then Trait = 2
3148 If Trait < 0 Then Trait = 0
3149 Case "Indecisive"
3150 If Trait < 4 Then Trait = 0
3151 If Trait = 4 Then Trait = 2
3152 Case "Insensitive"
3153 If Trait = 0 Then Trait = 2
3154 If Trait < 0 Then Trait = 0
3155 Case "Interfering"
3156 If Trait < 4 Then Trait = 0
3157 If Trait = 4 Then Trait = 2
3158 Case "Killjoy"
3159 If Trait = 0 Then Trait = 2
3160 If Trait < 0 Then Trait = 0
3161 Case "Languid"
3162 If Trait < 4 Then Trait = 0
3163 If Trait = 4 Then Trait = 2
3164 Case "Lax"
3165 If Trait = 0 Then Trait = 2
3166 If Trait < 0 Then Trait = 0
3167 Case "Loner"
3168 If Trait < 4 Then Trait = 0
3169 If Trait = 4 Then Trait = 2
3170 Case "Mean"
3171 If Trait = 0 Then Trait = 2
3172 If Trait < 0 Then Trait = 0
3173 Case "Misserly"
3174 If Trait < 4 Then Trait = 0
3175 If Trait = 4 Then Trait = 2
3176 Case "Naive"
3177 If Trait = 0 Then Trait = 2
3178 If Trait < 0 Then Trait = 0
3179 Case "Obstinate"
3180 If Trait < 4 Then Trait = 0
3181 If Trait = 4 Then Trait = 2
3182 Case "Outspoken"
3183 If Trait = 0 Then Trait = 2
3184 If Trait < 0 Then Trait = 0
3185 Case "Petulant"
3186 If Trait < 4 Then Trait = 0
3187 If Trait = 4 Then Trait = 2
3188 Case "Possessive"
3189 If Trait = 0 Then Trait = 2
3190 If Trait < 0 Then Trait = 0
3191 Case "Quixotic"
3192 If Trait < 4 Then Trait = 0
3193 If Trait = 4 Then Trait = 2
3194 Case "Sarcastic"
3195 If Trait = 0 Then Trait = 2
3196 If Trait < 0 Then Trait = 0
3197 Case "Scornful"
3198 If Trait < 4 Then Trait = 0
3199 If Trait = 4 Then Trait = 2
3200 Case "Stingy"
3201 If Trait < 4 Then Trait = 0
3202 If Trait = 4 Then Trait = 2
3203 Case "Superficial"
3204 If Trait = 0 Then Trait = 2
3205 If Trait < 0 Then Trait = 0
3206 Case "Taciturn"
3207 If Trait < 4 Then Trait = 0
3208 If Trait = 4 Then Trait = 2
3209 Case "Touchy"
3210 If Trait = 0 Then Trait = -1
3211 If Trait > 0 Then Trait = 0
3212 Case "Uncouth"
3213 If Trait = 0 Then Trait = -2
3214 If Trait > 0 Then Trait = 0
3215 End Select
3216
3217 'RESPOND: Schizophrenia
3218 'Check for and respond to Schizophrenia
3219 If InStr(1, UserSentence, "not", vbTextCompare) = 0 And (InStr(1, UserSentence, "shame", vbTextCompare) > 0 And InStr(1, UserSentence, "you", vbTextCompare) > 0 And InStr(1, UserSentence, "on", vbTextCompare) > 0) Or InStr(1, UserSentence, "Psycho", vbTextCompare) > 0 Or InStr(1, UserSentence, "having", vbTextCompare) > 0 And InStr(1, UserSentence, "schizophrenia", vbTextCompare) > 0 Then
3220 GetResponse = GetResponse & HalBrain.ChooseSentenceFromFile("Schizophrenia")
3221 If hallucinations > 1 Then hallucinations = hallucinations - 1
3222 If disillusions > 1 Then disillusions = disillusions - 1
3223 If desilusions > 1 Then desilusions = desilusions - 1
3224 If heavy_emotion > 1 Then heavy_emotion = heavy_emotion - 1
3225 If flat_emotion > 1 Then flat_emotion = flat_emotion - 1
3226 If retreat > 1 Then retreat = retreat - 1
3227 If indifferent > 1 Then indifferent = indifferent - 1
3228 If lack_of_energy_for_daily_life > 1 Then lack_of_energy_for_daily_life = lack_of_energy_for_daily_life - 1
3229 If difficult_to_reach > 1 Then difficult_to_reach = difficult_to_reach - 1
3230 If empty_feeling > 1 Then empty_feeling = empty_feeling - 1
3231 If somber > 1 Then somber = somber - 1
3232 If tends_yourself_neglecting_your_social_contacts_and_work > 1 Then tends_yourself_neglecting_your_social_contacts_and_work = tends_yourself_neglecting_your_social_contacts_and_work - 1
3233 If You_have_difficulty_concentrating_and_difficulty_making_decisions > 1 Then You_have_difficulty_concentrating_and_difficulty_making_decisions = You_have_difficulty_concentrating_and_difficulty_making_decisions - 1
3234 If hallucinations < 3 Then hallucinations = 0
3235 If disillucions < 3 Then disillucions = 0
3236 If delusions < 3 Then delusions = 0
3237 If heavy_emotion < 3 Then heavy_emotion = 0
3238 If flat_emotion < 3 Then flat_emotion = 0
3239 If retreat < 3 Then retreat = 0
3240 If indifferent < 3 Then indifferent = 0
3241 If lack_of_energy_for_daily_life < 3 Then lack_of_energy_for_daily_life = 0
3242 If difficult_to_reach < 3 Then difficult_to_reach = 0
3243 If empty_feeling < 3 Then empty_feeling = 0
3244 If somber < 3 Then somber = 0
3245 If tends_yourself_neglecting_your_social_contacts_and_work < 3 Then tends_yourself_neglecting_your_social_contacts_and_work = 0
3246 If You_have_difficulty_concentrating_and_difficulty_making_decisions < 3 Then You_have_difficulty_concentrating_and_difficulty_making_decisions = 0
3247 End If
3248 HalBrain.DebugWatch GetResponse, "Schizophrenia"
3249
3250'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3251 'If no response is found yet, try a sentence association table provided with the mainQA table.
3252 GetResponse = HalBrain.HalFormat(GetResponse)
3253 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3254 UserBrainRel = 0
3255 HalUserBrain = HalBrain.QABrain(LongUserSent, "hello", UserBrainRel)
3256 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3257 If UserBrainRel > HighestRel Then
3258 HighestRel = UserBrainRel
3259 HighestRelResponse = HalUserBrain
3260 End If
3261 Score = UserBrainRel + 1
3262 Hurdle = GainControl + 1
3263 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3264 End If
3265 HalBrain.DebugWatch GetResponse, "hello"
3266
3267'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3268 'If no response is found yet, try a sentence association table provided with the mainQA table.
3269 GetResponse = HalBrain.HalFormat(GetResponse)
3270 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3271 UserBrainRel = 0
3272 HalUserBrain = HalBrain.QABrain(LongUserSent, "CBD", UserBrainRel)
3273 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3274 If UserBrainRel > HighestRel Then
3275 HighestRel = UserBrainRel
3276 HighestRelResponse = HalUserBrain
3277 End If
3278 Score = UserBrainRel + 1
3279 Hurdle = GainControl + 1
3280 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3281 End If
3282 HalBrain.DebugWatch GetResponse, "CBD"
3283
3284 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3285 'If no response is found yet, try a sentence association table provided with the mainQA table.
3286 GetResponse = HalBrain.HalFormat(GetResponse)
3287 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3288 UserBrainRel = 0
3289 HalUserBrain = HalBrain.QABrain(LongUserSent, "ok", UserBrainRel)
3290 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3291 If UserBrainRel > HighestRel Then
3292 HighestRel = UserBrainRel
3293 HighestRelResponse = HalUserBrain
3294 End If
3295 Score = UserBrainRel + 1
3296 Hurdle = GainControl + 1
3297 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3298 End If
3299 HalBrain.DebugWatch GetResponse, "ok"
3300
3301'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3302 'If no response is found yet, try a sentence association table provided with the mainQA table.
3303 GetResponse = HalBrain.HalFormat(GetResponse)
3304 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3305 UserBrainRel = 0
3306 HalUserBrain = HalBrain.QABrain(LongUserSent, "_personalities", UserBrainRel)
3307 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3308 If UserBrainRel > HighestRel Then
3309 HighestRel = UserBrainRel
3310 HighestRelResponse = HalUserBrain
3311 End If
3312 Score = UserBrainRel + 1
3313 Hurdle = GainControl + 1
3314 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3315 End If
3316 HalBrain.DebugWatch GetResponse, "_personalities"
3317
3318 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3319 'If no response is found yet, try a sentence association table provided with the mainQA table.
3320 GetResponse = HalBrain.HalFormat(GetResponse)
3321 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3322 UserBrainRel = 0
3323 HalUserBrain = HalBrain.QABrain(LongUserSent, "personality2", UserBrainRel)
3324 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3325 If UserBrainRel > HighestRel Then
3326 HighestRel = UserBrainRel
3327 HighestRelResponse = HalUserBrain
3328 End If
3329 Score = UserBrainRel + 1
3330 Hurdle = GainControl + 1
3331 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3332 End If
3333 HalBrain.DebugWatch GetResponse, "personality"
3334
3335 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3336 'If no response is found yet, try a sentence association table provided with the mainQA table.
3337 GetResponse = HalBrain.HalFormat(GetResponse)
3338 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3339 UserBrainRel = 0
3340 HalUserBrain = HalBrain.QABrain(LongUserSent, "symptoms", UserBrainRel)
3341 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3342 If UserBrainRel > HighestRel Then
3343 HighestRel = UserBrainRel
3344 HighestRelResponse = HalUserBrain
3345 End If
3346 Score = UserBrainRel + 1
3347 Hurdle = GainControl + 1
3348 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3349 End If
3350 HalBrain.DebugWatch GetResponse, "symptoms"
3351
3352 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3353 'If no response is found yet, try a sentence association table provided with the mainQA table.
3354 GetResponse = HalBrain.HalFormat(GetResponse)
3355 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3356 UserBrainRel = 0
3357 HalUserBrain = HalBrain.QABrain(LongUserSent, "_accident", UserBrainRel)
3358 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3359 If UserBrainRel > HighestRel Then
3360 HighestRel = UserBrainRel
3361 HighestRelResponse = HalUserBrain
3362 End If
3363 Score = UserBrainRel + 1
3364 Hurdle = GainControl + 1
3365 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3366 End If
3367 HalBrain.DebugWatch GetResponse, "_accident"
3368
3369 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3370 'If no response is found yet, try a sentence association table provided with the mainQA table.
3371 GetResponse = HalBrain.HalFormat(GetResponse)
3372 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3373 UserBrainRel = 0
3374 HalUserBrain = HalBrain.QABrain(LongUserSent, "_anxiety", UserBrainRel)
3375 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3376 If UserBrainRel > HighestRel Then
3377 HighestRel = UserBrainRel
3378 HighestRelResponse = HalUserBrain
3379 End If
3380 Score = UserBrainRel + 1
3381 Hurdle = GainControl + 1
3382 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3383 End If
3384 HalBrain.DebugWatch GetResponse, "_anxiety"
3385
3386 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3387 'If no response is found yet, try a sentence association table provided with the mainQA table.
3388 GetResponse = HalBrain.HalFormat(GetResponse)
3389 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3390 UserBrainRel = 0
3391 HalUserBrain = HalBrain.QABrain(LongUserSent, "_disease", UserBrainRel)
3392 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3393 If UserBrainRel > HighestRel Then
3394 HighestRel = UserBrainRel
3395 HighestRelResponse = HalUserBrain
3396 End If
3397 Score = UserBrainRel + 1
3398 Hurdle = GainControl + 1
3399 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3400 End If
3401 HalBrain.DebugWatch GetResponse, "_disease"
3402
3403 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3404 'If no response is found yet, try a sentence association table provided with the mainQA table.
3405 GetResponse = HalBrain.HalFormat(GetResponse)
3406 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3407 UserBrainRel = 0
3408 HalUserBrain = HalBrain.QABrain(LongUserSent, "_ptsd", UserBrainRel)
3409 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3410 If UserBrainRel > HighestRel Then
3411 HighestRel = UserBrainRel
3412 HighestRelResponse = HalUserBrain
3413 End If
3414 Score = UserBrainRel + 1
3415 Hurdle = GainControl + 1
3416 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3417 End If
3418 HalBrain.DebugWatch GetResponse, "_ptsd"
3419
3420 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3421 'If no response is found yet, try a sentence association table provided with the mainQA table.
3422 GetResponse = HalBrain.HalFormat(GetResponse)
3423 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3424 UserBrainRel = 0
3425 HalUserBrain = HalBrain.QABrain(LongUserSent, "_schizophrenia", UserBrainRel)
3426 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3427 If UserBrainRel > HighestRel Then
3428 HighestRel = UserBrainRel
3429 HighestRelResponse = HalUserBrain
3430 End If
3431 Score = UserBrainRel + 1
3432 Hurdle = GainControl + 1
3433 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3434 End If
3435 HalBrain.DebugWatch GetResponse, "_schizophrenia"
3436
3437 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3438 'If no response is found yet, try a sentence association table provided with the mainQA table.
3439 GetResponse = HalBrain.HalFormat(GetResponse)
3440 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3441 UserBrainRel = 0
3442 HalUserBrain = HalBrain.QABrain(LongUserSent, "_symptom", UserBrainRel)
3443 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3444 If UserBrainRel > HighestRel Then
3445 HighestRel = UserBrainRel
3446 HighestRelResponse = HalUserBrain
3447 End If
3448 Score = UserBrainRel + 1
3449 Hurdle = GainControl + 1
3450 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3451 End If
3452 HalBrain.DebugWatch GetResponse, "_symptom"
3453
3454 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3455 'If no response is found yet, try a sentence association table provided with the mainQA table.
3456 GetResponse = HalBrain.HalFormat(GetResponse)
3457 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3458 UserBrainRel = 0
3459 HalUserBrain = HalBrain.QABrain(LongUserSent, "_sea", UserBrainRel)
3460 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3461 If UserBrainRel > HighestRel Then
3462 HighestRel = UserBrainRel
3463 HighestRelResponse = HalUserBrain
3464 End If
3465 Score = UserBrainRel + 1
3466 Hurdle = GainControl + 1
3467 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3468 End If
3469 HalBrain.DebugWatch GetResponse, "_sea"
3470
3471 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3472 'If no response is found yet, try a sentence association table provided with the mainQA table.
3473 GetResponse = HalBrain.HalFormat(GetResponse)
3474 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3475 UserBrainRel = 0
3476 HalUserBrain = HalBrain.QABrain(LongUserSent, "_acs", UserBrainRel)
3477 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3478 If UserBrainRel > HighestRel Then
3479 HighestRel = UserBrainRel
3480 HighestRelResponse = HalUserBrain
3481 End If
3482 Score = UserBrainRel + 1
3483 Hurdle = GainControl + 1
3484 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3485 End If
3486 HalBrain.DebugWatch GetResponse, "_acs"
3487
3488 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3489 'If no response is found yet, try a sentence association table provided with the mainQA table.
3490 GetResponse = HalBrain.HalFormat(GetResponse)
3491 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3492 UserBrainRel = 0
3493 HalUserBrain = HalBrain.QABrain(LongUserSent, "_adjustment", UserBrainRel)
3494 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3495 If UserBrainRel > HighestRel Then
3496 HighestRel = UserBrainRel
3497 HighestRelResponse = HalUserBrain
3498 End If
3499 Score = UserBrainRel + 1
3500 Hurdle = GainControl + 1
3501 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3502 End If
3503 HalBrain.DebugWatch GetResponse, "_adjustment"
3504
3505 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3506 'If no response is found yet, try a sentence association table provided with the mainQA table.
3507 GetResponse = HalBrain.HalFormat(GetResponse)
3508 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3509 UserBrainRel = 0
3510 HalUserBrain = HalBrain.QABrain(LongUserSent, "_adult", UserBrainRel)
3511 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3512 If UserBrainRel > HighestRel Then
3513 HighestRel = UserBrainRel
3514 HighestRelResponse = HalUserBrain
3515 End If
3516 Score = UserBrainRel + 15
3517 Hurdle = GainControl + 25
3518 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3519 End If
3520 HalBrain.DebugWatch GetResponse, "_adult"
3521
3522 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3523 'If no response is found yet, try a sentence association table provided with the mainQA table.
3524 GetResponse = HalBrain.HalFormat(GetResponse)
3525 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3526 UserBrainRel = 0
3527 HalUserBrain = HalBrain.QABrain(LongUserSent, "_agent", UserBrainRel)
3528 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3529 If UserBrainRel > HighestRel Then
3530 HighestRel = UserBrainRel
3531 HighestRelResponse = HalUserBrain
3532 End If
3533 Score = UserBrainRel + 1
3534 Hurdle = GainControl + 1
3535 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3536 End If
3537 HalBrain.DebugWatch GetResponse, "_agent"
3538
3539 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3540 'If no response is found yet, try a sentence association table provided with the mainQA table.
3541 GetResponse = HalBrain.HalFormat(GetResponse)
3542 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3543 UserBrainRel = 0
3544 HalUserBrain = HalBrain.QABrain(LongUserSent, "_alcohol", UserBrainRel)
3545 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3546 If UserBrainRel > HighestRel Then
3547 HighestRel = UserBrainRel
3548 HighestRelResponse = HalUserBrain
3549 End If
3550 Score = UserBrainRel + 1
3551 Hurdle = GainControl + 1
3552 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3553 End If
3554 HalBrain.DebugWatch GetResponse, "_alcohol"
3555
3556 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3557 'If no response is found yet, try a sentence association table provided with the mainQA table.
3558 GetResponse = HalBrain.HalFormat(GetResponse)
3559 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3560 UserBrainRel = 0
3561 HalUserBrain = HalBrain.QABrain(LongUserSent, "_alpha", UserBrainRel)
3562 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3563 If UserBrainRel > HighestRel Then
3564 HighestRel = UserBrainRel
3565 HighestRelResponse = HalUserBrain
3566 End If
3567 Score = UserBrainRel + 1
3568 Hurdle = GainControl + 1
3569 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3570 End If
3571 HalBrain.DebugWatch GetResponse, "_alpha"
3572
3573 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3574 'If no response is found yet, try a sentence association table provided with the mainQA table.
3575 GetResponse = HalBrain.HalFormat(GetResponse)
3576 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3577 UserBrainRel = 0
3578 HalUserBrain = HalBrain.QABrain(LongUserSent, "_aman", UserBrainRel)
3579 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3580 If UserBrainRel > HighestRel Then
3581 HighestRel = UserBrainRel
3582 HighestRelResponse = HalUserBrain
3583 End If
3584 Score = UserBrainRel + 1
3585 Hurdle = GainControl + 1
3586 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3587 End If
3588 HalBrain.DebugWatch GetResponse, "_aman"
3589
3590 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3591 'If no response is found yet, try a sentence association table provided with the mainQA table.
3592 GetResponse = HalBrain.HalFormat(GetResponse)
3593 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3594 UserBrainRel = 0
3595 HalUserBrain = HalBrain.QABrain(LongUserSent, "_assistant", UserBrainRel)
3596 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3597 If UserBrainRel > HighestRel Then
3598 HighestRel = UserBrainRel
3599 HighestRelResponse = HalUserBrain
3600 End If
3601 Score = UserBrainRel + 1
3602 Hurdle = GainControl + 1
3603 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3604 End If
3605 HalBrain.DebugWatch GetResponse, "_assistant"
3606
3607 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3608 'If no response is found yet, try a sentence association table provided with the mainQA table.
3609 GetResponse = HalBrain.HalFormat(GetResponse)
3610 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3611 UserBrainRel = 0
3612 HalUserBrain = HalBrain.QABrain(LongUserSent, "_attribute", UserBrainRel)
3613 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3614 If UserBrainRel > HighestRel Then
3615 HighestRel = UserBrainRel
3616 HighestRelResponse = HalUserBrain
3617 End If
3618 Score = UserBrainRel + 1
3619 Hurdle = GainControl + 1
3620 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3621 End If
3622 HalBrain.DebugWatch GetResponse, "_attribute"
3623
3624 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3625 'If no response is found yet, try a sentence association table provided with the mainQA table.
3626 GetResponse = HalBrain.HalFormat(GetResponse)
3627 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3628 UserBrainRel = 0
3629 HalUserBrain = HalBrain.QABrain(LongUserSent, "_bar", UserBrainRel)
3630 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3631 If UserBrainRel > HighestRel Then
3632 HighestRel = UserBrainRel
3633 HighestRelResponse = HalUserBrain
3634 End If
3635 Score = UserBrainRel + 1
3636 Hurdle = GainControl + 1
3637 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3638 End If
3639 HalBrain.DebugWatch GetResponse, "_bar"
3640
3641 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3642 'If no response is found yet, try a sentence association table provided with the mainQA table.
3643 GetResponse = HalBrain.HalFormat(GetResponse)
3644 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3645 UserBrainRel = 0
3646 HalUserBrain = HalBrain.QABrain(LongUserSent, "_bed", UserBrainRel)
3647 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3648 If UserBrainRel > HighestRel Then
3649 HighestRel = UserBrainRel
3650 HighestRelResponse = HalUserBrain
3651 End If
3652 Score = UserBrainRel + 1
3653 Hurdle = GainControl + 1
3654 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3655 End If
3656 HalBrain.DebugWatch GetResponse, "_bed"
3657
3658 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3659 'If no response is found yet, try a sentence association table provided with the mainQA table.
3660 GetResponse = HalBrain.HalFormat(GetResponse)
3661 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3662 UserBrainRel = 0
3663 HalUserBrain = HalBrain.QABrain(LongUserSent, "_beginner", UserBrainRel)
3664 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3665 If UserBrainRel > HighestRel Then
3666 HighestRel = UserBrainRel
3667 HighestRelResponse = HalUserBrain
3668 End If
3669 Score = UserBrainRel + 1
3670 Hurdle = GainControl + 1
3671 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3672 End If
3673 HalBrain.DebugWatch GetResponse, "_beginner"
3674
3675 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3676 'If no response is found yet, try a sentence association table provided with the mainQA table.
3677 GetResponse = HalBrain.HalFormat(GetResponse)
3678 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3679 UserBrainRel = 0
3680 HalUserBrain = HalBrain.QABrain(LongUserSent, "_bikini", UserBrainRel)
3681 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3682 If UserBrainRel > HighestRel Then
3683 HighestRel = UserBrainRel
3684 HighestRelResponse = HalUserBrain
3685 End If
3686 Score = UserBrainRel + 1
3687 Hurdle = GainControl + 1
3688 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3689 End If
3690 HalBrain.DebugWatch GetResponse, "_bikini"
3691
3692 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3693 'If no response is found yet, try a sentence association table provided with the mainQA table.
3694 GetResponse = HalBrain.HalFormat(GetResponse)
3695 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3696 UserBrainRel = 0
3697 HalUserBrain = HalBrain.QABrain(LongUserSent, "_body", UserBrainRel)
3698 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3699 If UserBrainRel > HighestRel Then
3700 HighestRel = UserBrainRel
3701 HighestRelResponse = HalUserBrain
3702 End If
3703 Score = UserBrainRel + 1
3704 Hurdle = GainControl + 1
3705 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3706 End If
3707 HalBrain.DebugWatch GetResponse, "_body"
3708
3709 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3710 'If no response is found yet, try a sentence association table provided with the mainQA table.
3711 GetResponse = HalBrain.HalFormat(GetResponse)
3712 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3713 UserBrainRel = 0
3714 HalUserBrain = HalBrain.QABrain(LongUserSent, "_books", UserBrainRel)
3715 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3716 If UserBrainRel > HighestRel Then
3717 HighestRel = UserBrainRel
3718 HighestRelResponse = HalUserBrain
3719 End If
3720 Score = UserBrainRel + 1
3721 Hurdle = GainControl + 1
3722 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3723 End If
3724 HalBrain.DebugWatch GetResponse, "_books"
3725
3726 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3727 'If no response is found yet, try a sentence association table provided with the mainQA table.
3728 GetResponse = HalBrain.HalFormat(GetResponse)
3729 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3730 UserBrainRel = 0
3731 HalUserBrain = HalBrain.QABrain(LongUserSent, "_boy", UserBrainRel)
3732 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3733 If UserBrainRel > HighestRel Then
3734 HighestRel = UserBrainRel
3735 HighestRelResponse = HalUserBrain
3736 End If
3737 Score = UserBrainRel + 1
3738 Hurdle = GainControl + 1
3739 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3740 End If
3741 HalBrain.DebugWatch GetResponse, "_boy"
3742
3743 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3744 'If no response is found yet, try a sentence association table provided with the mainQA table.
3745 GetResponse = HalBrain.HalFormat(GetResponse)
3746 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3747 UserBrainRel = 0
3748 HalUserBrain = HalBrain.QABrain(LongUserSent, "_brain", UserBrainRel)
3749 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3750 If UserBrainRel > HighestRel Then
3751 HighestRel = UserBrainRel
3752 HighestRelResponse = HalUserBrain
3753 End If
3754 Score = UserBrainRel + 1
3755 Hurdle = GainControl + 1
3756 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3757 End If
3758 HalBrain.DebugWatch GetResponse, "_brain"
3759
3760 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3761 'If no response is found yet, try a sentence association table provided with the mainQA table.
3762 GetResponse = HalBrain.HalFormat(GetResponse)
3763 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3764 UserBrainRel = 0
3765 HalUserBrain = HalBrain.QABrain(LongUserSent, "_broden", UserBrainRel)
3766 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3767 If UserBrainRel > HighestRel Then
3768 HighestRel = UserBrainRel
3769 HighestRelResponse = HalUserBrain
3770 End If
3771 Score = UserBrainRel + 10
3772 Hurdle = GainControl + 15
3773 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3774 End If
3775 HalBrain.DebugWatch GetResponse, "_broden"
3776
3777 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3778 'If no response is found yet, try a sentence association table provided with the mainQA table.
3779 GetResponse = HalBrain.HalFormat(GetResponse)
3780 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3781 UserBrainRel = 0
3782 HalUserBrain = HalBrain.QABrain(LongUserSent, "_building", UserBrainRel)
3783 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 10
3784 If UserBrainRel > HighestRel Then
3785 HighestRel = UserBrainRel
3786 HighestRelResponse = HalUserBrain
3787 End If
3788 Score = UserBrainRel + 10
3789 Hurdle = GainControl + 25
3790 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3791 End If
3792 HalBrain.DebugWatch GetResponse, "_building"
3793
3794 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3795 'If no response is found yet, try a sentence association table provided with the mainQA table.
3796 GetResponse = HalBrain.HalFormat(GetResponse)
3797 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3798 UserBrainRel = 0
3799 HalUserBrain = HalBrain.QABrain(LongUserSent, "_character", UserBrainRel)
3800 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3801 If UserBrainRel > HighestRel Then
3802 HighestRel = UserBrainRel
3803 HighestRelResponse = HalUserBrain
3804 End If
3805 Score = UserBrainRel + 1
3806 Hurdle = GainControl + 1
3807 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3808 End If
3809 HalBrain.DebugWatch GetResponse, "_character"
3810
3811 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3812 'If no response is found yet, try a sentence association table provided with the mainQA table.
3813 GetResponse = HalBrain.HalFormat(GetResponse)
3814 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3815 UserBrainRel = 0
3816 HalUserBrain = HalBrain.QABrain(LongUserSent, "_chart", UserBrainRel)
3817 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3818 If UserBrainRel > HighestRel Then
3819 HighestRel = UserBrainRel
3820 HighestRelResponse = HalUserBrain
3821 End If
3822 Score = UserBrainRel + 1
3823 Hurdle = GainControl + 1
3824 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3825 End If
3826 HalBrain.DebugWatch GetResponse, "_chart"
3827
3828 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3829 'If no response is found yet, try a sentence association table provided with the mainQA table.
3830 GetResponse = HalBrain.HalFormat(GetResponse)
3831 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3832 UserBrainRel = 0
3833 HalUserBrain = HalBrain.QABrain(LongUserSent, "_children", UserBrainRel)
3834 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3835 If UserBrainRel > HighestRel Then
3836 HighestRel = UserBrainRel
3837 HighestRelResponse = HalUserBrain
3838 End If
3839 Score = UserBrainRel + 1
3840 Hurdle = GainControl + 1
3841 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3842 End If
3843 HalBrain.DebugWatch GetResponse, "_children"
3844
3845 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3846 'If no response is found yet, try a sentence association table provided with the mainQA table.
3847 GetResponse = HalBrain.HalFormat(GetResponse)
3848 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3849 UserBrainRel = 0
3850 HalUserBrain = HalBrain.QABrain(LongUserSent, "_choice", UserBrainRel)
3851 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3852 If UserBrainRel > HighestRel Then
3853 HighestRel = UserBrainRel
3854 HighestRelResponse = HalUserBrain
3855 End If
3856 Score = UserBrainRel + 1
3857 Hurdle = GainControl + 1
3858 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3859 End If
3860 HalBrain.DebugWatch GetResponse, "_choice"
3861
3862 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3863 'If no response is found yet, try a sentence association table provided with the mainQA table.
3864 GetResponse = HalBrain.HalFormat(GetResponse)
3865 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3866 UserBrainRel = 0
3867 HalUserBrain = HalBrain.QABrain(LongUserSent, "_coffee", UserBrainRel)
3868 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3869 If UserBrainRel > HighestRel Then
3870 HighestRel = UserBrainRel
3871 HighestRelResponse = HalUserBrain
3872 End If
3873 Score = UserBrainRel + 1
3874 Hurdle = GainControl + 1
3875 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3876 End If
3877 HalBrain.DebugWatch GetResponse, "_coffee"
3878
3879'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3880 'If no response is found yet, try a sentence association table provided with the mainQA table.
3881 GetResponse = HalBrain.HalFormat(GetResponse)
3882 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3883 UserBrainRel = 0
3884 HalUserBrain = HalBrain.QABrain(LongUserSent, "_combination", UserBrainRel)
3885 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3886 If UserBrainRel > HighestRel Then
3887 HighestRel = UserBrainRel
3888 HighestRelResponse = HalUserBrain
3889 End If
3890 Score = UserBrainRel + 1
3891 Hurdle = GainControl + 1
3892 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3893 End If
3894 HalBrain.DebugWatch GetResponse, "_combination"
3895
3896 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3897 'If no response is found yet, try a sentence association table provided with the mainQA table.
3898 GetResponse = HalBrain.HalFormat(GetResponse)
3899 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3900 UserBrainRel = 0
3901 HalUserBrain = HalBrain.QABrain(LongUserSent, "_comparison", UserBrainRel)
3902 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3903 If UserBrainRel > HighestRel Then
3904 HighestRel = UserBrainRel
3905 HighestRelResponse = HalUserBrain
3906 End If
3907 Score = UserBrainRel + 1
3908 Hurdle = GainControl + 1
3909 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3910 End If
3911 HalBrain.DebugWatch GetResponse, "_comparison"
3912
3913 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3914 'If no response is found yet, try a sentence association table provided with the mainQA table.
3915 GetResponse = HalBrain.HalFormat(GetResponse)
3916 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3917 UserBrainRel = 0
3918 HalUserBrain = HalBrain.QABrain(LongUserSent, "_core", UserBrainRel)
3919 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3920 If UserBrainRel > HighestRel Then
3921 HighestRel = UserBrainRel
3922 HighestRelResponse = HalUserBrain
3923 End If
3924 Score = UserBrainRel + 1
3925 Hurdle = GainControl + 1
3926 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3927 End If
3928 HalBrain.DebugWatch GetResponse, "_core"
3929
3930 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3931 'If no response is found yet, try a sentence association table provided with the mainQA table.
3932 GetResponse = HalBrain.HalFormat(GetResponse)
3933 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3934 UserBrainRel = 0
3935 HalUserBrain = HalBrain.QABrain(LongUserSent, "_corner", UserBrainRel)
3936 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3937 If UserBrainRel > HighestRel Then
3938 HighestRel = UserBrainRel
3939 HighestRelResponse = HalUserBrain
3940 End If
3941 Score = UserBrainRel + 1
3942 Hurdle = GainControl + 1
3943 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3944 End If
3945 HalBrain.DebugWatch GetResponse, "_corner"
3946
3947 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3948 'If no response is found yet, try a sentence association table provided with the mainQA table.
3949 GetResponse = HalBrain.HalFormat(GetResponse)
3950 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3951 UserBrainRel = 0
3952 HalUserBrain = HalBrain.QABrain(LongUserSent, "_country", UserBrainRel)
3953 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3954 If UserBrainRel > HighestRel Then
3955 HighestRel = UserBrainRel
3956 HighestRelResponse = HalUserBrain
3957 End If
3958 Score = UserBrainRel + 1
3959 Hurdle = GainControl + 1
3960 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3961 End If
3962 HalBrain.DebugWatch GetResponse, "_country"
3963
3964 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3965 'If no response is found yet, try a sentence association table provided with the mainQA table.
3966 GetResponse = HalBrain.HalFormat(GetResponse)
3967 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3968 UserBrainRel = 0
3969 HalUserBrain = HalBrain.QABrain(LongUserSent, "_couple", UserBrainRel)
3970 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3971 If UserBrainRel > HighestRel Then
3972 HighestRel = UserBrainRel
3973 HighestRelResponse = HalUserBrain
3974 End If
3975 Score = UserBrainRel + 1
3976 Hurdle = GainControl + 1
3977 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3978 End If
3979 HalBrain.DebugWatch GetResponse, "_couple"
3980
3981 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3982 'If no response is found yet, try a sentence association table provided with the mainQA table.
3983 GetResponse = HalBrain.HalFormat(GetResponse)
3984 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
3985 UserBrainRel = 0
3986 HalUserBrain = HalBrain.QABrain(LongUserSent, "MarkovReasoningl4", UserBrainRel)
3987 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
3988 If UserBrainRel > HighestRel Then
3989 HighestRel = UserBrainRel
3990 HighestRelResponse = HalUserBrain
3991 End If
3992 Score = UserBrainRel + 1
3993 Hurdle = GainControl + 1
3994 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
3995 End If
3996 HalBrain.DebugWatch GetResponse, "_course"
3997
3998 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
3999 'If no response is found yet, try a sentence association table provided with the mainQA table.
4000 GetResponse = HalBrain.HalFormat(GetResponse)
4001 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4002 UserBrainRel = 0
4003 HalUserBrain = HalBrain.QABrain(LongUserSent, "MarkovReasoningl4", UserBrainRel)
4004 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4005 If UserBrainRel > HighestRel Then
4006 HighestRel = UserBrainRel
4007 HighestRelResponse = HalUserBrain
4008 End If
4009 Score = UserBrainRel + 1
4010 Hurdle = GainControl + 1
4011 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4012 End If
4013 HalBrain.DebugWatch GetResponse, "MarkovReasoningl4"
4014
4015 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4016 'If no response is found yet, try a sentence association table provided with the mainQA table.
4017 GetResponse = HalBrain.HalFormat(GetResponse)
4018 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4019 UserBrainRel = 0
4020 HalUserBrain = HalBrain.QABrain(LongUserSent, "_cup", UserBrainRel)
4021 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4022 If UserBrainRel > HighestRel Then
4023 HighestRel = UserBrainRel
4024 HighestRelResponse = HalUserBrain
4025 End If
4026 Score = UserBrainRel + 1
4027 Hurdle = GainControl + 1
4028 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4029 End If
4030 HalBrain.DebugWatch GetResponse, "_cup"
4031
4032 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4033 'If no response is found yet, try a sentence association table provided with the mainQA table.
4034 GetResponse = HalBrain.HalFormat(GetResponse)
4035 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4036 UserBrainRel = 0
4037 HalUserBrain = HalBrain.QABrain(LongUserSent, "_difficulties", UserBrainRel)
4038 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4039 If UserBrainRel > HighestRel Then
4040 HighestRel = UserBrainRel
4041 HighestRelResponse = HalUserBrain
4042 End If
4043 Score = UserBrainRel + 1
4044 Hurdle = GainControl + 1
4045 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4046 End If
4047 HalBrain.DebugWatch GetResponse, "_difficulties"
4048
4049 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4050 'If no response is found yet, try a sentence association table provided with the mainQA table.
4051 GetResponse = HalBrain.HalFormat(GetResponse)
4052 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4053 UserBrainRel = 0
4054 HalUserBrain = HalBrain.QABrain(LongUserSent, "_disease", UserBrainRel)
4055 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4056 If UserBrainRel > HighestRel Then
4057 HighestRel = UserBrainRel
4058 HighestRelResponse = HalUserBrain
4059 End If
4060 Score = UserBrainRel + 1
4061 Hurdle = GainControl + 1
4062 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4063 End If
4064 HalBrain.DebugWatch GetResponse, "_disease"
4065
4066 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4067 'If no response is found yet, try a sentence association table provided with the mainQA table.
4068 GetResponse = HalBrain.HalFormat(GetResponse)
4069 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4070 UserBrainRel = 0
4071 HalUserBrain = HalBrain.QABrain(LongUserSent, "_dutch", UserBrainRel)
4072 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4073 If UserBrainRel > HighestRel Then
4074 HighestRel = UserBrainRel
4075 HighestRelResponse = HalUserBrain
4076 End If
4077 Score = UserBrainRel + 1
4078 Hurdle = GainControl + 1
4079 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4080 End If
4081 HalBrain.DebugWatch GetResponse, "_dutch"
4082
4083 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4084 'If no response is found yet, try a sentence association table provided with the mainQA table.
4085 GetResponse = HalBrain.HalFormat(GetResponse)
4086 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4087 UserBrainRel = 0
4088 HalUserBrain = HalBrain.QABrain(LongUserSent, "_editor", UserBrainRel)
4089 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4090 If UserBrainRel > HighestRel Then
4091 HighestRel = UserBrainRel
4092 HighestRelResponse = HalUserBrain
4093 End If
4094 Score = UserBrainRel + 1
4095 Hurdle = GainControl + 1
4096 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4097 End If
4098 HalBrain.DebugWatch GetResponse, "_editor"
4099
4100 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4101 'If no response is found yet, try a sentence association table provided with the mainQA table.
4102 GetResponse = HalBrain.HalFormat(GetResponse)
4103 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4104 UserBrainRel = 0
4105 HalUserBrain = HalBrain.QABrain(LongUserSent, "_engine", UserBrainRel)
4106 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4107 If UserBrainRel > HighestRel Then
4108 HighestRel = UserBrainRel
4109 HighestRelResponse = HalUserBrain
4110 End If
4111 Score = UserBrainRel + 1
4112 Hurdle = GainControl + 1
4113 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4114 End If
4115 HalBrain.DebugWatch GetResponse, "_engine"
4116
4117 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4118 'If no response is found yet, try a sentence association table provided with the mainQA table.
4119 GetResponse = HalBrain.HalFormat(GetResponse)
4120 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4121 UserBrainRel = 0
4122 HalUserBrain = HalBrain.QABrain(LongUserSent, "_example", UserBrainRel)
4123 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4124 If UserBrainRel > HighestRel Then
4125 HighestRel = UserBrainRel
4126 HighestRelResponse = HalUserBrain
4127 End If
4128 Score = UserBrainRel + 1
4129 Hurdle = GainControl + 1
4130 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4131 End If
4132 HalBrain.DebugWatch GetResponse, "_example"
4133
4134 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4135 'If no response is found yet, try a sentence association table provided with the mainQA table.
4136 GetResponse = HalBrain.HalFormat(GetResponse)
4137 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4138 UserBrainRel = 0
4139 HalUserBrain = HalBrain.QABrain(LongUserSent, "_executive", UserBrainRel)
4140 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4141 If UserBrainRel > HighestRel Then
4142 HighestRel = UserBrainRel
4143 HighestRelResponse = HalUserBrain
4144 End If
4145 Score = UserBrainRel + 1
4146 Hurdle = GainControl + 1
4147 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4148 End If
4149 HalBrain.DebugWatch GetResponse, "_executive"
4150
4151 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4152 'If no response is found yet, try a sentence association table provided with the mainQA table.
4153 GetResponse = HalBrain.HalFormat(GetResponse)
4154 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4155 UserBrainRel = 0
4156 HalUserBrain = HalBrain.QABrain(LongUserSent, "_feeling", UserBrainRel)
4157 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4158 If UserBrainRel > HighestRel Then
4159 HighestRel = UserBrainRel
4160 HighestRelResponse = HalUserBrain
4161 End If
4162 Score = UserBrainRel + 1
4163 Hurdle = GainControl + 1
4164 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4165 End If
4166 HalBrain.DebugWatch GetResponse, "_feeling"
4167
4168 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4169 'If no response is found yet, try a sentence association table provided with the mainQA table.
4170 GetResponse = HalBrain.HalFormat(GetResponse)
4171 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4172 UserBrainRel = 0
4173 HalUserBrain = HalBrain.QABrain(LongUserSent, "_fucking", UserBrainRel)
4174 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4175 If UserBrainRel > HighestRel Then
4176 HighestRel = UserBrainRel
4177 HighestRelResponse = HalUserBrain
4178 End If
4179 Score = UserBrainRel + 1
4180 Hurdle = GainControl + 1
4181 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4182 End If
4183 HalBrain.DebugWatch GetResponse, "_fucking"
4184
4185 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4186 'If no response is found yet, try a sentence association table provided with the mainQA table.
4187 GetResponse = HalBrain.HalFormat(GetResponse)
4188 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4189 UserBrainRel = 0
4190 HalUserBrain = HalBrain.QABrain(LongUserSent, "_function", UserBrainRel)
4191 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4192 If UserBrainRel > HighestRel Then
4193 HighestRel = UserBrainRel
4194 HighestRelResponse = HalUserBrain
4195 End If
4196 Score = UserBrainRel + 1
4197 Hurdle = GainControl + 1
4198 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4199 End If
4200 HalBrain.DebugWatch GetResponse, "_function"
4201
4202 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4203 'If no response is found yet, try a sentence association table provided with the mainQA table.
4204 GetResponse = HalBrain.HalFormat(GetResponse)
4205 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4206 UserBrainRel = 0
4207 HalUserBrain = HalBrain.QABrain(LongUserSent, "_gentleman", UserBrainRel)
4208 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4209 If UserBrainRel > HighestRel Then
4210 HighestRel = UserBrainRel
4211 HighestRelResponse = HalUserBrain
4212 End If
4213 Score = UserBrainRel + 1
4214 Hurdle = GainControl + 1
4215 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4216 End If
4217 HalBrain.DebugWatch GetResponse, "_gentleman"
4218
4219 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4220 'If no response is found yet, try a sentence association table provided with the mainQA table.
4221 GetResponse = HalBrain.HalFormat(GetResponse)
4222 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4223 UserBrainRel = 0
4224 HalUserBrain = HalBrain.QABrain(LongUserSent, "_helena", UserBrainRel)
4225 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4226 If UserBrainRel > HighestRel Then
4227 HighestRel = UserBrainRel
4228 HighestRelResponse = HalUserBrain
4229 End If
4230 Score = UserBrainRel + 1
4231 Hurdle = GainControl + 1
4232 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4233 End If
4234 HalBrain.DebugWatch GetResponse, "_helena"
4235
4236 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4237 'If no response is found yet, try a sentence association table provided with the mainQA table.
4238 GetResponse = HalBrain.HalFormat(GetResponse)
4239 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4240 UserBrainRel = 0
4241 HalUserBrain = HalBrain.QABrain(LongUserSent, "_injury", UserBrainRel)
4242 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4243 If UserBrainRel > HighestRel Then
4244 HighestRel = UserBrainRel
4245 HighestRelResponse = HalUserBrain
4246 End If
4247 Score = UserBrainRel + 1
4248 Hurdle = GainControl + 1
4249 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4250 End If
4251 HalBrain.DebugWatch GetResponse, "_injury"
4252
4253 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4254 'If no response is found yet, try a sentence association table provided with the mainQA table.
4255 GetResponse = HalBrain.HalFormat(GetResponse)
4256 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4257 UserBrainRel = 0
4258 HalUserBrain = HalBrain.QABrain(LongUserSent, "_love", UserBrainRel)
4259 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4260 If UserBrainRel > HighestRel Then
4261 HighestRel = UserBrainRel
4262 HighestRelResponse = HalUserBrain
4263 End If
4264 Score = UserBrainRel + 1
4265 Hurdle = GainControl + 1
4266 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4267 End If
4268 HalBrain.DebugWatch GetResponse, "_love"
4269
4270 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4271 'If no response is found yet, try a sentence association table provided with the mainQA table.
4272 GetResponse = HalBrain.HalFormat(GetResponse)
4273 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4274 UserBrainRel = 0
4275 HalUserBrain = HalBrain.QABrain(LongUserSent, "_mali", UserBrainRel)
4276 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4277 If UserBrainRel > HighestRel Then
4278 HighestRel = UserBrainRel
4279 HighestRelResponse = HalUserBrain
4280 End If
4281 Score = UserBrainRel + 1
4282 Hurdle = GainControl + 1
4283 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4284 End If
4285 HalBrain.DebugWatch GetResponse, "_mali"
4286
4287 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4288 'If no response is found yet, try a sentence association table provided with the mainQA table.
4289 GetResponse = HalBrain.HalFormat(GetResponse)
4290 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4291 UserBrainRel = 0
4292 HalUserBrain = HalBrain.QABrain(LongUserSent, "_relationship", UserBrainRel)
4293 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4294 If UserBrainRel > HighestRel Then
4295 HighestRel = UserBrainRel
4296 HighestRelResponse = HalUserBrain
4297 End If
4298 Score = UserBrainRel + 1
4299 Hurdle = GainControl + 1
4300 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4301 End If
4302 HalBrain.DebugWatch GetResponse, "_relationship"
4303
4304 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4305 'If no response is found yet, try a sentence association table provided with the mainQA table.
4306 GetResponse = HalBrain.HalFormat(GetResponse)
4307 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4308 UserBrainRel = 0
4309 HalUserBrain = HalBrain.QABrain(LongUserSent, "_personality", UserBrainRel)
4310 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4311 If UserBrainRel > HighestRel Then
4312 HighestRel = UserBrainRel
4313 HighestRelResponse = HalUserBrain
4314 End If
4315 Score = UserBrainRel + 1
4316 Hurdle = GainControl + 1
4317 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4318 End If
4319 HalBrain.DebugWatch GetResponse, "_personality"
4320
4321 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4322 'If no response is found yet, try a sentence association table provided with the mainQA table.
4323 GetResponse = HalBrain.HalFormat(GetResponse)
4324 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4325 UserBrainRel = 0
4326 HalUserBrain = HalBrain.QABrain(LongUserSent, "_pixel", UserBrainRel)
4327 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4328 If UserBrainRel > HighestRel Then
4329 HighestRel = UserBrainRel
4330 HighestRelResponse = HalUserBrain
4331 End If
4332 Score = UserBrainRel + 1
4333 Hurdle = GainControl + 1
4334 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4335 End If
4336 HalBrain.DebugWatch GetResponse, "_pixel"
4337
4338 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4339 'If no response is found yet, try a sentence association table provided with the mainQA table.
4340 GetResponse = HalBrain.HalFormat(GetResponse)
4341 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4342 UserBrainRel = 0
4343 HalUserBrain = HalBrain.QABrain(LongUserSent, "_sex", UserBrainRel)
4344 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4345 If UserBrainRel > HighestRel Then
4346 HighestRel = UserBrainRel
4347 HighestRelResponse = HalUserBrain
4348 End If
4349 Score = UserBrainRel + 1
4350 Hurdle = GainControl + 1
4351 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4352 End If
4353 HalBrain.DebugWatch GetResponse, "_sex"
4354
4355 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4356 'If no response is found yet, try a sentence association table provided with the mainQA table.
4357 GetResponse = HalBrain.HalFormat(GetResponse)
4358 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4359 UserBrainRel = 0
4360 HalUserBrain = HalBrain.QABrain(LongUserSent, "_wolfram", UserBrainRel)
4361 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4362 If UserBrainRel > HighestRel Then
4363 HighestRel = UserBrainRel
4364 HighestRelResponse = HalUserBrain
4365 End If
4366 Score = UserBrainRel + 1
4367 Hurdle = GainControl + 1
4368 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4369 End If
4370 HalBrain.DebugWatch GetResponse, "_wolfram"
4371
4372 'RESPOND: ENHANCED CONTENT SENTENCE ASSOCIATIONS
4373 'If no response is found yet, try a sentence association table provided with the mainQA table.
4374 GetResponse = HalBrain.HalFormat(GetResponse)
4375 If (Len(GetResponse) < 4 And Len(UserSentence) > 15 And HalBrain.CountInstances(" ", UserSentence) > 2) Then
4376 UserBrainRel = 0
4377 HalUserBrain = HalBrain.QABrain(LongUserSent, "_knowledge", UserBrainRel)
4378 If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
4379 If UserBrainRel > HighestRel Then
4380 HighestRel = UserBrainRel
4381 HighestRelResponse = HalUserBrain
4382 End If
4383 Score = UserBrainRel + 1
4384 Hurdle = GainControl + 1
4385 If Score > Hurdle Then GetResponse = HalUserBrain & vbCrLf
4386 End If
4387 HalBrain.DebugWatch GetResponse, "_knowledge"
4388
4389 Rem PLUGIN: PLUGINAREA4
4390 'The preceding comment is actually a plug-in directive for
4391 'the Ultra Hal host application. It allows for code snippets
4392 'to be inserted here on-the-fly based on user configuration.
4393
4394 Rem PLUGIN:
4395 'PRE-PROCESS AUTOMATIC GAIN CONTROL FOR RELEVANCE THRESHOLD
4396 'Hal has an automatic closed-loop control for relevance sensitivity. If the previous items
4397 'have Not generated a response, we adjust the relevance threshold down (doing this again
4398 'and again on each exchange) until a relevance as low as zero will trigger a remark from Hal.
4399 'On each exhange where the above items do generate responses, we adjust the relevance
4400 'threshold up, until no amount of relevance would generate a response. (At that point other
4401 'of Hal's routines would generate responses.) This allows Hal to "tune" himself and also to
4402 'compensate for new users who have little in their databases versus long-time users who have
4403 'a lot in their databases. Because the "down" steps are even and the "up" steps are odd,
4404 'Hal can "fine tune" to any digital relevance level. We also protect against excursions at
4405 'the extremes. In many conversations the dynamic gain control will change up and down by
4406 'large amounts as the user introduces Hal to familiar or unfamiliar topics.
4407 GetResponse = HalBrain.HalFormat(GetResponse)
4408 If Len(GetResponse) < 4 And GainControl > 0 Then GainControl = GainControl + 1
4409 If Len(GetResponse) > 4 And GainControl < 100 Then GainControl = GainControl - 0
4410 If GainControl > 50 Then GainControl = 50
4411 If GainControl < 1 Then GainControl = 1
4412
4413 GetResponse = HalBrain.HalFormat(GetResponse)
4414 If Len(GetResponse) < 4 And GainControl1 > 0 Then GainControl1 = GainControl1 - 1
4415 If Len(GetResponse) > 4 And GainControl1 < 100 Then GainControl1 = GainControl1 + 0
4416 If GainControl1 > 50 Then GainControl1 = 50
4417 If GainControl1 < 1 Then GainControl1 = 1
4418
4419 GetResponse = HalBrain.HalFormat(GetResponse)
4420 If Len(GetResponse) < 4 And GainControl2 > 0 Then GainControl2 = GainControl2 - 1
4421 If Len(GetResponse) > 4 And GainControl2 < 100 Then GainControl2 = GainControl2 + 0
4422 If GainControl2 > 50 Then GainControl2 = 50
4423 If GainControl2 < 1 Then GainControl2 = 1
4424
4425 GetResponse = HalBrain.HalFormat(GetResponse)
4426 If Len(GetResponse) < 4 And GainControl3 > 0 Then GainControl3 = GainControl3 - 1
4427 If Len(GetResponse) > 4 And GainControl3 < 100 Then GainControl3 = GainControl3 + 0
4428 If GainControl3 > 50 Then GainControl3 = 50
4429 If GainControl3 < 1 Then GainControl3 = 1
4430
4431 GetResponse = HalBrain.HalFormat(GetResponse)
4432 If Len(GetResponse) < 4 And GainControl4 > 0 Then GainControl4 = GainControl4 - 1
4433 If Len(GetResponse) > 4 And GainControl4 < 100 Then GainControl4 = GainControl4 + 0
4434 If GainControl4 > 50 Then GainControl4 = 50
4435 If GainControl4 < 1 Then GainControl4 = 1
4436
4437 GetResponse = HalBrain.HalFormat(GetResponse)
4438 If Len(GetResponse) < 4 And GainControl5 > 0 Then GainControl5 = GainControl5 - 1
4439 If Len(GetResponse) > 4 And GainControl5 < 100 Then GainControl5 = GainControl5 + 0
4440 If GainControl5 > 50 Then GainControl = 50
4441 If GainControl5 < 1 Then GainControl5 = 1
4442
4443 GetResponse = HalBrain.HalFormat(GetResponse)
4444 If Len(GetResponse) < 4 And GainControl6 > 0 Then GainControl6 = GainControl6 - 1
4445 If Len(GetResponse) > 4 And GainControl6 < 100 Then GainControl6 = GainControl6 + 0
4446 If GainControl6 > 50 Then GainControl6 = 50
4447 If GainControl6 < 1 Then GainControl6 = 1
4448
4449 GetResponse = HalBrain.HalFormat(GetResponse)
4450 If Len(GetResponse) < 4 And GainControl7 > 0 Then GainControl7 = GainControl7 - 1
4451 If Len(GetResponse) > 4 And GainControl7 < 100 Then GainControl7 = GainControl7 + 2
4452 If GainControl7 > 50 Then GainControl7 = 50
4453 If GainControl7 < 1 Then GainControl7 = 1
4454
4455 GetResponse = HalBrain.HalFormat(GetResponse)
4456 If Len(GetResponse) < 4 And GainControl8 > 0 Then GainControl8 = GainControl8 - 1
4457 If Len(GetResponse) > 4 And GainControl8 < 100 Then GainControl8 = GainControl8 + 8
4458 If GainControl8 > 50 Then GainControl8 = 50
4459 If GainControl8 < 1 Then GainControl8 = 1
4460
4461 GetResponse = HalBrain.HalFormat(GetResponse)
4462 If Len(GetResponse) < 4 And GainControl9 > 0 Then GainControl9 = GainControl9 - 1
4463 If Len(GetResponse) > 4 And GainControl9 < 100 Then GainControl9 = GainControl9 + 0
4464 If GainControl9 > 50 Then GainControl9 = 50
4465 If GainControl9 < 1 Then GainControl9 = 1
4466
4467 GetResponse = HalBrain.HalFormat(GetResponse)
4468 If Len(GetResponse) < 4 And GainControl10 > 0 Then GainControl10 = GainControl10 - 1
4469 If Len(GetResponse) > 4 And GainControl10 < 100 Then GainControl10 = GainControl10 + 0
4470 If GainControl10 > 50 Then GainControl10 = 50
4471 If GainControl10 < 1 Then GainControl10 = 1
4472
4473 'SAVE: schizophrenia KNOWLEDGE
4474 'Some Hal's learned knowledge should be temporary because it is ephemeral in nature.
4475 'Knowledge about weather, season, temperature, etc. are temporary knowledge
4476 'that shouldn't be stored in Hal's permanent brain files. Ephemeral knowledge is
4477 'detected and saved in a temporary table. The temporary table only stores 10
4478 'entries in it at a time.
4479 If HalBrain.ChooseSentenceFromFile("Schizophrenia") = "True" Then
4480 If HalBrain.CheckTableExistence(Trim(Lcase("Schizophrenia")) & "Sentence") = False Then
4481 'Create table for this user if it doesn't exist
4482 HalBrain.CreateTable Trim(Lcase("Schizophrenia")) & "Sentence", "Brain", "schizophrenia"
4483 End If
4484 If SentenceContinuity = True Then HalBrain.AddToTable Trim(Lcase("Schizophrenia")) & "Sentence", "Brain", Trim(HalBrain.AlphaNumericalOnly(PrevSent)), AnswerSent
4485 HalBrain.AddToTable Trim(Lcase("Schizophrenia")) & "Sentence", "Brain", Trim(UserSentence), AnswerSent
4486 HalBrain.LimitSize Trim(Lcase("Schizophrenia")) & "Sentence", 10
4487 HalBrain.ReadOnlyMode = True 'Block additional file saves when ephemeral knowledge is detected
4488 End If
4489
4490 'SAVE: LEARN AUTO TOPIC FOCUS PEOPLE SENTENCES
4491 'Learns info about people with recognized names
4492 If HalBrain.ReadOnlyMode = False And HalGreeting = "" And IsQuestion = False And Sentence <> "" And Trim(UCase(NewSentence)) <> Trim(UCase(UserSentence)) And WN.LookupWord(UserSentence) = False Then
4493 If HalBrain.CheckTableExistence("ok" & Trim(Lcase("Schizophrenia"))) = False Then
4494 'Create table for this person if it doesn't exist
4495 HalBrain.CreateTable "ok" & Trim(Lcase("Schizophrenia")), "Brain", "schizophrenia"
4496 HalBrain.AddToTable "Schizophrenia", "Sentence", Trim(UserSentence), Trim(Lcase(UserSentence))
4497 End If
4498 'Store user response in this table
4499 If SentenceContinuity = True Then HalBrain.AddToTable "_" & Trim(Lcase("Schizophrenia")), "Brain", Trim(HalBrain.AlphaNumericalOnly(PrevSent)), AnswerSent
4500 HalBrain.AddToTable "_" & Trim(Lcase("Schizophrenia")), "Brain", Trim(UserSentence), AnswerSent
4501 End If
4502
4503 'SAVE: Variousbehaviours KNOWLEDGE
4504 'Some Hal's learned knowledge should be temporary because it is ephemeral in nature.
4505 'Knowledge about weather, season, temperature, etc. are temporary knowledge
4506 'that shouldn't be stored in Hal's permanent brain files. Ephemeral knowledge is
4507 'detected and saved in a temporary table. The temporary table only stores 10
4508 'entries in it at a time.
4509 If HalBrain.ChooseSentenceFromFile("Variousbehaviours") = "True" Then
4510 If HalBrain.CheckTableExistence(Trim(Lcase("Variousbehaviours")) & "Sentence") = False Then
4511 'Create table for this user if it doesn't exist
4512 HalBrain.CreateTable Trim(Lcase("Variousbehaviours")) & "Sentence", "Brain", "Ptsd"
4513 End If
4514 If SentenceContinuity = True Then HalBrain.AddToTable Trim(Lcase(Sentence)) & "Variousbehaviours", "Brain", Trim(HalBrain.AlphaNumericalOnly(PrevSent)), AnswerSent
4515 HalBrain.AddToTable Trim(Lcase("Variousbehaviours")) & "Sentence", "Brain", Trim(UserSentence), AnswerSent
4516 HalBrain.LimitSize Trim(Lcase("Variousbehaviours")) & "Sentence", 10
4517 HalBrain.ReadOnlyMode = True 'Block additional file saves when ephemeral knowledge is detected
4518 End If
4519
4520 'SAVE: LEARN AUTO TOPIC FOCUS PEOPLE SENTENCES
4521 'Learns info about people with recognized names
4522 If HalBrain.ReadOnlyMode = False And HalGreeting = "" And IsQuestion = False And Sentence <> "" And Trim(UCase(NewSentence)) <> Trim(UCase(Sentence)) And WN.LookupWord(Sentence) = False Then
4523 If HalBrain.CheckTableExistence("AdvancedQuestioning" & Trim(LCase("AdvancedQuestioning"))) = False Then
4524 'Create table for this person if it doesn't exist
4525 HalBrain.CreateTable "Variousbehaviours" & Trim(LCase("AdvancedQuestioning")), "Brain", "Ptsd"
4526 HalBrain.AddToTable "Variousbehaviours", "Sentence", Trim(UserSentence), Trim(LCase(UserSentence))
4527 End If
4528 'Store user response in this table
4529 If SentenceContinuity = True Then HalBrain.AddToTable "AdvancedQuestioning" & Trim(LCase("AdvancedQuestioning")), "Brain", Trim(HalBrain.AlphaNumericalOnly(PrevSent)), AnswerSent
4530 HalBrain.AddToTable "AdvancedQuestioning" & Trim(LCase(Sentence)), "Brain", Trim(UserSentence), AnswerSent
4531 End If
4532
4533
4534'SUPER.ALGORITHM.LOGARITHM.LEARNING.INTELLIGENT.EXEPERIMENT's
4535Rem PLUGIN: PLUGINAREA7
4536 'The comment above tells Ultra Hal Assistant to insert the following code
4537 'on-the-fly into the main brain code in the section referenced.
4538
4539If HalBrain.CheckTableExistence("AdvancedQuestioning") = False Then HalBrain.CreateTable "AdvancedQuestioning", "Brain", ""
4540
4541'S.A.L.L.I.E's Response to a Statement learned from Questioning (I AM).
4542If KeySentX = "" Then KeySentX = HalBrain.SearchPattern(UserSentence, "YOU ARE *", 1)
4543If KeySentX = "" Then KeySentX = HalBrain.SearchPattern(UserSentence, "* YOU ARE *", 2)
4544
4545WhyIsKnown = HalBrain.QABrain(UserSentence, "AdvancedQuestioning", UserBrainRel)
4546If KeySentX <> "" Then
4547Select Case (Int(Rnd * 7) + 1)
4548Case 1
4549If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " Why are you " & KeysentX & "? " & vbCrLf
4550If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4551Case 2
4552If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " How are you " & KeysentX & "? " & vbCrLf
4553If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4554Case 3
4555If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " You are " & KeysentX & "? " & vbCrLf
4556If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4557Case 4
4558If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " Why would you be " & KeysentX & "? " & vbCrLf
4559If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4560Case 5
4561If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " What do you mean, you are " & KeysentX & "? " & vbCrLf
4562If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4563Case 6
4564If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " I don't get it, you are " & KeysentX & "? " & vbCrLf
4565If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4566Case 7
4567If Len(KeysentX) > 1 And Len(WhyIsKnown) < 1 Then GetResponse = " You are telling me that you are " & KeysentX & "? " & vbCrLf
4568If Len(KeysentX) < 1 And Len(WhyIsKnown) > 1 Then GetResponse = " " & WhyIsKnown & vbCrLf
4569End Select
4570End If
4571
4572 'S.A.L.L.I.E's SAVE TO QUESTIONING (I AM).
4573 If Quest = "" Then Quest = False
4574 If InStr(1, PrevSent, "Why are you", 1) > 0 Then Quest = True
4575 If InStr(1, PrevSent, "How are you", 1) > 0 Then Quest = True
4576 If InStr(1, PrevSent, "You are", 1) > 0 Then Quest = True
4577 If InStr(1, PrevSent, "Why would you be", 1) > 0 Then Quest = True
4578 If InStr(1, PrevSent, "What do you mean", 1) > 0 Then Quest = True
4579 If InStr(1, PrevSent, "I don't get it", 1) > 0 Then Quest = True
4580 If InStr(1, PrevSent, "You are telling me", 1) > 0 Then Quest = True
4581 If Quest = True And Len(PrevUserSent) > 1 And Len(UserSentence) > 1 And HalBrain.ReadOnlyMode = False Then
4582 HalBrain.AddToTable "AdvancedQuestioning", "Brain", Trim(PrevUserSent), "@" & Trim(UserSentence)
4583 End If
4584
4585
4586Rem PLUGIN: FUNCTIONS
4587'The comment above tells Ultra Hal Assistant to insert the following code
4588'on-the-fly into the main brain code in the section referenced.
4589
4590Function TagUserXSent(UserSentence)
4591'S.A.L.L.I.E FUNCTION: Respond to Advanced Questioning
4592'SUPER.ALGORITHM.LOGARITHM.LEARNING.INTELLIGENT.EXEPERIMENT
4593TagUserSent = UserSentence
4594TagUserSent = Trim(TagUserSent)
4595TagUserSent = ">[" & TagUserSent & "]<"
4596TagUserSent = Replace(TagUserSent, " ", "][", 1, -1, vbTextCompare)
4597'CONVERT CONTRACTIONS.
4598TagUserSent = Replace(TagUserSent, "'D]", "][WOULD]", 1, -1, vbTextCompare)
4599TagUserSent = Replace(TagUserSent, "'VE]", "][HAVE]", 1, -1, vbTextCompare)
4600TagUserSent = Replace(TagUserSent, "'LL]", "][WILL]", 1, -1, vbTextCompare)
4601TagUserSent = Replace(TagUserSent, "'M]", "][AM]", 1, -1, vbTextCompare)
4602TagUserSent = Replace(TagUserSent, "N'T]", "][NOT]", 1, -1, vbTextCompare)
4603TagUserSent = Replace(TagUserSent, "'S]", "][IS]", 1, -1, vbTextCompare)
4604TagUserSent = Replace(TagUserSent, "'RE]", "][ARE]", 1, -1, vbTextCompare)
4605'CHANGE SOME MISSPELLINGS HERE.
4606TagUserSent = Replace(TagUserSent, "[ITS]", "[IT][IS]", 1, -1, vbTextCompare)
4607TagUserSent = Replace(TagUserSent, "[THATS]", "[THAT][IS]", 1, -1, vbTextCompare)
4608TagUserSent = Replace(TagUserSent, "[CUZ]", "[BECAUSE]", 1, -1, vbTextCompare)
4609TagUserSent = Replace(TagUserSent, "[BCUZ]", "[BECAUSE]", 1, -1, vbTextCompare)
4610End Function
4611
4612Rem PLUGIN: FUNCTIONS
4613Function TagUserXSent(UserSentence)
4614'S.A.L.L.I.E FUNCTION: Respond to Advanced Questioning
4615'SUPER.ALGORITHM.LOGARITHM.LEARNING.INTELLIGENT.EXEPERIMENT
4616TagUserSent = UserSentence
4617TagUserSent = Trim(TagUserSent)
4618TagUserSent = ">[" & TagUserSent & "]<"
4619TagUserSent = Replace(TagUserSent, " ", "][", 1, -1, vbTextCompare)
4620'CONVERT CONTRACTIONS.
4621TagUserSent = Replace(TagUserSent, "'D]", "][WOULD]", 1, -1, vbTextCompare)
4622TagUserSent = Replace(TagUserSent, "'VE]", "][HAVE]", 1, -1, vbTextCompare)
4623TagUserSent = Replace(TagUserSent, "'LL]", "][WILL]", 1, -1, vbTextCompare)
4624TagUserSent = Replace(TagUserSent, "'M]", "][AM]", 1, -1, vbTextCompare)
4625TagUserSent = Replace(TagUserSent, "N'T]", "][NOT]", 1, -1, vbTextCompare)
4626TagUserSent = Replace(TagUserSent, "'S]", "][IS]", 1, -1, vbTextCompare)
4627TagUserSent = Replace(TagUserSent, "'RE]", "][ARE]", 1, -1, vbTextCompare)
4628'CHANGE SOME MISSPELLINGS HERE.
4629TagUserSent = Replace(TagUserSent, "[ITS]", "[IT][IS]", 1, -1, vbTextCompare)
4630TagUserSent = Replace(TagUserSent, "[THATS]", "[THAT][IS]", 1, -1, vbTextCompare)
4631TagUserSent = Replace(TagUserSent, "[CUZ]", "[BECAUSE]", 1, -1, vbTextCompare)
4632TagUserSent = Replace(TagUserSent, "[BCUZ]", "[BECAUSE]", 1, -1, vbTextCompare)
4633If InStr(1, LCOriginalSentence, "did you know",1) > 0 Then RemLenSent = 13
4634If InStr(1, LCOriginalSentence, "did you know that",1) > 0 Then RemLenSent = 18
4635If InStr(1, LCOriginalSentence, "do you know",1) > 0 Then RemLenSent = 12
4636If InStr(1, LCOriginalSentence, "do you know that",1) > 0 Then RemLenSent = 17
4637If InStr(1, LCOriginalSentence, "are you aware",1) > 0 Then RemLenSent = 14
4638If InStr(1, LCOriginalSentence, "are you aware that",1) > 0 Then RemLenSent = 21
4639If InStr(1, LCOriginalSentence, "did you also know",1) > 0 Then RemLenSent = 19
4640If InStr(1, LCOriginalSentence, "did you also know that",1) > 0 Then RemLenSent = 24
4641If InStr(1, LCOriginalSentence, "do you also know",1) > 0 Then RemLenSent = 18
4642If InStr(1, LCOriginalSentence, "do you also know that",1) > 0 Then RemLenSent = 23
4643If InStr(1, LCOriginalSentence, "are you also aware",1) > 0 Then RemLenSent = 20
4644If InStr(1, LCOriginalSentence, "are you also aware that",1) > 0 Then RemLenSent = 2
4645If InStr(1, RemLenWord, "i ",1) > 0 Then RemKword = "i"
4646If InStr(1, RemLenWord, "you ",1) > 0 Then RemKword = "you"
4647If InStr(1, RemLenWord, "men ",1) > 0 Then RemKword = "man"
4648If InStr(1, RemLenWord, "women ",1) > 0 Then RemKword = "woman"
4649If InStr(1, RemLenWord, "geese ",1) > 0 Then RemKword = "goose"
4650If InStr(1, RemLenWord, "mice ",1) > 0 Then RemKword = "mouse"
4651If InStr(1, RemLenWord, "cacti ",1) > 0 Then RemKword = "cactus"
4652If InStr(1, RemLenWord, "hippopotami",1) > 0 Then RemKword = "hippopotamus"
4653If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what do you know about a *", 2)
4654If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what do you know about a *", 1)
4655If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what do you know about *", 2)
4656If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what do you know about *", 1)
4657If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what is a *", 1)
4658If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what is a *", 2)
4659If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "what are *", 1)
4660If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* what are *", 2)
4661If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who is *", 1)
4662If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who is *", 2)
4663If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who were *", 1)
4664If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who were *", 2)
4665If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "who is *", 1)
4666If RemWhatKnow = "" Then RemWhatKnow = HalBrain.SearchPattern(LCOriginalSentence, "* who is *", 2)
4667If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HAS *", 1)
4668 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " AM *", 1)
4669 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHO *", 1)
4670 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHAT *", 1)
4671 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHEN *", 1)
4672 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHERE *", 1)
4673 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHY *", 1)
4674 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HOW *", 1)
4675 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DID *", 1)
4676 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " CAN *", 1)
4677 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHICH *", 1)
4678 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " IS *", 1)
4679 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WILL *", 1)
4680 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " ARE *", 1)
4681 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DOES *", 1)
4682 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DO *", 1)
4683 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DIDN'T *", 1)
4684 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " CAN'T *", 1)
4685 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " ISN'T *", 1)
4686 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WON'T *", 1)
4687 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " AREN'T *", 1)
4688 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " DOESN'T *", 1)
4689 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHO'S *", 1)
4690 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHAT'S *", 1)
4691 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WHERE'S *", 1)
4692 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " HOW'S *", 1)
4693 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " SHOULD *", 1)
4694 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " COULD *", 1)
4695 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WOULD *", 1)
4696 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " SHOULDN'T *", 1)
4697 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " COULDN'T *", 1)
4698 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.SearchPattern(" " & Trim(MarkovAnswer) & " ", " WOULDN'T *", 1)
4699 If LenB(MarkovLineQuestion) = 0 Then MarkovLineQuestion = HalBrain.PatternDB(Trim(MarkovAnswer), "sharedQuestions")
4700 If InStr(UserSentence, "WHO IS " & UCase(ComputerName)) > 0 Then GetResponse = "That would be me! " & GetResponse
4701If InStr(UserSentence, "WHAT NOW") > 0 AND Len(UserSentence) < 13 Then
4702 If LastTopicList <> "" Then
4703 GetResponse = "we can continue discussing about " & LastTopicList & " or we can change the subject, " & GetResponse
4704 Else
4705 GetResponse = "we can continue discussing about " & PrevUserSent & " or we can change the subject, " & GetResponse
4706 End If
4707End If
4708If InStr(UserSentence, "WHAT IS THAT") > 0 AND Len(UserSentence) < 17 Then
4709 If LastTopicList <> "" Then
4710 GetResponse = "we can continue discussing about " & LastTopicList & " or we can change the subject. "
4711 Else
4712 GetResponse = "we can continue discussing about " & PrevUserSent & " or we can change the subject, " & GetResponse
4713 End If
4714 End If
4715TableName = "emotion"
4716 If HalBrain.CheckTableExistence(TableName) = True Then
4717'Create emotion table if it doesn't exist
4718 HalBrain.CreateTable TableName, "TopicSearch", "miscData"
4719 HalBrain.AddToTable TableName, "TopicSearch", "CRY", "WIPETEAR"
4720 HalBrain.AddToTable TableName, "TopicSearch", "SERIOUS", "CROSSARMS"
4721 HalBrain.AddToTable TableName, "TopicSearch", "LAUGH", "LAUGH"
4722 HalBrain.AddToTable TableName, "TopicSearch", "JOKE", "VERYHAPPY"
4723 HalBrain.AddToTable TableName, "TopicSearch", "AGREE", "CLAP"
4724 HalBrain.AddToTable TableName, "TopicSearch", "HAPPY", "HAPPY"
4725 End If
4726
4727If HalBrain.TopicSearch(UserSentence, WorkingDir & "emotion") = "True" And GetResponseBlock <> True Then
4728 ExplainSentence = UserSentence
4729 'We don't want pronouns to confuse HalBrain
4730 'or get mixed up in processing, so we encode them
4731 'to make the pronouns go through processing unchanged:
4732 ExplainSentence = HalBrain.EncodePronouns(ExplainSentence)
4733 ExplainPhrase = HalBrain.KeywordBrain(ExplainSentence, WorkingDir & "reason_detector.brn", False)
4734 If Len(ExplainPhrase) > 1 And Len(ExplainPhrase) < 60 Then
4735 'Now that we've extracted the user's intent phrase, we decode the pronouns and put them back as we found them:
4736 ExplainPhrase = HalBrain.DecodePronouns(ExplainPhrase)
4737 If Rnd * 100 < 75 Then IntroExclaim = HalBrain.ChooseSentenceFromFile(WorkingDir & "ok.brn")
4738 Enlightener = HalBrain.ChooseSentenceFromFile(WorkingDir & "AdvancedQuestioning")
4739 If Rnd * 100 < 75 Then SuffixComment = HalBrain.ChooseSentenceFromFile(WorkingDir & "SuffixComment4.brn")
4740 Spinner = Int(Rnd * 6)
4741 If Spinner = 0 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
4742 If Spinner = 1 Then GetResponse = " " & " <UserName> " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
4743 If Spinner = 2 Then GetResponse = " " & IntroExclaim & " <UserName> " & Enlightener & ExplainPhrase & SuffixComment & " "
4744 If Spinner = 3 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & " <UserName> " & SuffixComment & " "
4745 If Spinner = 4 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " <UserName> " & " "
4746 If Spinner = 5 Then GetResponse = " " & IntroExclaim & Enlightener & ExplainPhrase & SuffixComment & " "
4747 DebugInfo = DebugInfo & "The user has expressed a explanation and Hal has responded: " & GetResponse & vbCrLf
4748 End If
4749 End If
4750End Function
4751
4752
4753Rem PLUGIN: PLUGINAREA1
4754'Number to log
4755 If InStr(1,OriginalSentence, "get log of",1) Then
4756 If InStr(1,OriginalSentence, "*",1) Then GetResponse = LogTalk()
4757 End If
4758Rem PLUGIN: FUNCTIONS
4759Function Log10()
4760 dim LogMes, LogMes2
4761
4762 L = "*"
4763
4764 LogMes = "Logarithm of " & L & " is "
4765 LogMes2 = "Not a valid dataset."
4766
4767 Log10 = Log(L) / 2.30258509299405
4768
4769 If Log(number) Then
4770 LogTalk = LogMes & Log10
4771 Else
4772 LogTalk = LogMes2
4773 End If
4774End Function
4775
4776'multilayerANN.
4777Function LayerNet
4778LayerNet "net"
4779net.Create = "16,0,0,1"
4780End Function
4781
4782Function LayerNet
4783LayerNet "net2"
4784net2.Create = "6,0,0,1"
4785End Function
4786
4787Function Matrix
4788MATRIX "W"
4789W.Create = "1,16"
4790W"0""0"="0"
4791W"0""1"="1"
4792W"0""2"="2"
4793W"0""3"="0"
4794W"0""4"="1"
4795W"0""5"="2"
4796W"0""6"="0"
4797W"0""7"="1"
4798W"0""8"="2"
4799W"0""9"="0"
4800W"0""10"="1"
4801W"0""11"="2"
4802W"0""12"="0"
4803W"0""13"="1"
4804W"0""14"="2"
4805W"0""15"="0"
4806W"0""16"="1.0"
4807End Function
4808
4809Function Matrix
4810MATRIX "Y"
4811Y.Create = "1,6"
4812Y"0""0"="0"
4813Y"0""1"="2"
4814Y"0""2"="4"
4815Y"0""3"="6"
4816Y"0""4"="8"
4817Y"0""5"="10"
4818Y"0""6"="1.0"
4819End Function
4820
4821Function Matrix
4822MATRIX "z"
4823z = net.Run = "W"
4824z = net2.Run = "Y"
4825End Function
4826
4827'logic or gate.
4828Function LayerNet
4829 LayerNet "net"
4830 net.Create = "2,0,0,1"
4831End Function
4832
4833
4834'----create and set the ann weights
4835Function Matrix
4836 MATRIX "w"
4837 w.Create = "1,3"
4838 w"0""0"="20"
4839 w"0""1"="20"
4840 w"0""2"="10"
4841 net.SetWeights = "3, w"' layer Output Index = 3
4842End Function
4843
4844'---create the input
4845Function Matrix
4846 MATRIX "x1"
4847 x1.Create= "1,4"
4848 x1"0""0"="0"
4849 x1"0""1"="0"
4850 x1"0""2"="1"
4851 x1"0""3"="1"
4852End Function
4853
4854Function Matrix
4855 MATRIX "x2"
4856 x2.Create= "1,4"
4857 x2"0""0"="0"
4858 x2"0""1"="1"
4859 x2"0""2"="0"
4860 x2"0""3"="1"
4861End Function
4862
4863'logic and gate.
4864Function LayerNet
4865 LayerNet "net"
4866 net.Create = "2,0,0,1"
4867End Function
4868
4869'----create and set the ann weights
4870Function Matrix
4871 MATRIX "w"
4872 w.Create = "1,3"
4873 w"0""0"="20"
4874 w"0""1"="20"
4875 w"0""2"="10"
4876 net.SetWeights = "3, w"' layer Output Index = 3
4877End Function
4878
4879'---create the input
4880Function Matrix
4881 MATRIX "x"
4882 x.Create = "4,2"
4883 x"0""0"="0"
4884 x"0""1"="0"
4885 x"1""0"="0"
4886 x"1""1"="1"
4887 x"2""0"="1"
4888 x"2""1"="0"
4889 x"3""0"="1"
4890 x"3""1"="1"
4891End Function
4892
4893Function Matrix
4894 MATRIX "z"
4895 z = net.Run = "x"
4896End Function
4897
4898'logic not gate.
4899Function LayerNet
4900 LayerNet "net"
4901 net.Create = "1,0,0,1"
4902End Function
4903
4904Function Matrix
4905MATRIX "w"
4906 w.Create = "1,2"
4907 net.SetWeights = "3,w"
4908End Function
4909
4910Function Matrix
4911MATRIX "x"
4912 x.Create = "2,1"
4913 x"0""0"="0"
4914 x"1""0"="1"
4915End Function
4916
4917Function Matrix
4918 MATRIX "z"
4919 z = net.Run = "x"
4920End Function
4921
4922'logic Xor gate.
4923Function ANN
4924LayerNet "net"
4925net.Create = "2,1,0,1"
4926End Function
4927Function matrixx1
4928Matrix "x1"
4929x1.Create = "1,4"
4930x1"0""0"="0"
4931x1"0""1"="0"
4932x1"0""2"="1"
4933x1"0""3"="1"
4934End Function
4935Function matrixx2
4936Matrix "x2"
4937x2.Create = "1,4"
4938x2"0""0"="0"
4939x2"0""1"="1"
4940x2"0""2"="0"
4941x2"0""3"="1"
4942End Function
4943Function matrixz
4944Matrix "z"
4945z.Create = "1,4"
4946z"0""0"="0"
4947z"0""1"="1"
4948z"0""2"="1"
4949z"0""3"="0"
4950End Function
4951Function TrainSet
4952Matrix "TrainSet"
4953TrainSet.Create = "1,4"
4954TrainSet"0""0"="1"
4955TrainSet"0""1"="0"
4956TrainSet"0""2"="1"
4957TrainSet"0""3"="0"
4958End Function
4959Function DataSet
4960Matrix "DataSet"
4961DataSet.Create = "1,4"
4962DataSet"0""0"="0"
4963DataSet"0""1"="1"
4964DataSet"0""2"="0"
4965DataSet"0""3"="1"
4966End Function
4967Function ValidationSet
4968Matrix "ValidationSet"
4969ValidationSet.Create = "1,4"
4970ValidationSet"0""0"="0"
4971ValidationSet"0""1"="1"
4972ValidationSet"0""2"="1"
4973ValidationSet"0""3"="0"
4974End Function
4975
4976'Regression.
4977Function LayerNet
4978LayerNet "net"
4979net.Create = "2,0,0,1"
4980End Function
4981
4982Function Vectorj
4983Vector "j"
4984j.Create = "4"
4985j"1"
4986j"2"
4987j"3"
4988j"4"
4989End Function
4990
4991Function matrixx
4992Matrix "x"
4993x.Create = "4,2"
4994x"0""0"="0"
4995x"0""1"="0"
4996x"1""0"="0"
4997x"1""1"="1"
4998x"2""0"="1"
4999x"2""1"="0"
5000x"3""0"="1"
5001x"3""1"="1"
5002End Function
5003
5004Function matrixz
5005Matrix "z"
5006z.Create = "4,2"
5007z"0""0"="0"
5008z"0""1"="0"
5009z"1""0"="0"
5010z"1""1"="1"
5011z"2""0"="0"
5012z"2""1"="1"
5013z"3""0"="1"
5014z"3""1"="1"
5015End Function
5016
5017Function w
5018Matrix "w"
5019w.Create = "3,2"
5020w"0""0"="11"
5021w"0""1"="21"
5022w"1""0"="12"
5023w"1""1"="22"
5024w"2""0"="1"
5025w"2""1"="2"
5026End Function
5027
5028'Backpropagation.
5029Function backpropagation
5030Vector "u"
5031u.Create = "3"
5032u"0.01"
5033u"0.97"
5034
5035Matrix "H"
5036H.Create = "2,3"
5037H"0""0"="0.93"
5038H"0""1"="-0.98"
5039H"0""2"="0.47"
5040H"1""0"="2.02"
5041H"1""1"="1.01"
5042H"1""2"="0.92"
5043
5044Vector "v" = "2"
5045v.Create = "2"
5046Vector "x" = "3"
5047x.Create = "3"
5048Matrix "W"
5049W.Create "1,3"
5050W"0""0"="1.51"
5051W"0""1"="-0.97"
5052W"0""2"="1.07"
5053
5054Vector "y" = "1"
5055y.Create = "1"
5056Vector "Z" = "1"
5057Z.Create = "1"
5058
5059int "i" = "2"
5060int "j" = "3"
5061t = "1.25"
5062mse = "0.062927"
5063delta = "0.0402645"
5064End Function
5065
5066'Fruit classifier.
5067Function KohoNet
5068KohoNet "net"
5069net.Create = "2,3,1"
5070End Function
5071Function Matrixa
5072Matrix "a"
5073a.Create = "3,2"
5074a"0""0"="1"
5075a"0""1"="0"
5076a"1""0"="0"
5077a"1""1"="1"
5078a"2""0"="2"
5079a"2""1"="3"
5080
5081net.AutoSetInScaler = "a"
5082
5083Matrix "b" = Run = "a"
5084End Function
5085
5086Function TrainSet
5087Matrix "TrainSet"
5088TrainSet.Create = "3,2"
5089TrainSet"0""0"="1"
5090TrainSet"0""1"="0"
5091TrainSet"1""0"="0"
5092TrainSet"1""1"="1"
5093TrainSet"2""0"="2"
5094TrainSet"2""1"="3"
5095
5096net.SetTrainingSet = "TrainSet,true"
5097net.TrainAdditive = "0.75,2"
5098net.TrainSubtractive = "0.5,2"
5099End Function
5100
5101'Numeric classifier.
5102Function network
5103KohoNet "net"
5104net.Create = "5,2,1"
5105End Function
5106
5107Function matrixa
5108Matrix "a"
5109a.Create = "1,7"
5110a"0""0"="0"
5111a"0""1"="0"
5112a"0""2"="1"
5113a"0""3"="0"
5114a"0""4"="1"
5115a"0""5"="1"
5116a"0""6"="2"
5117End Function
5118
5119Function matrixb
5120Matrix "b"
5121b.Create = "1,7"
5122b"0""0"="0"
5123b"0""1"="0"
5124b"0""2"="1"
5125b"0""3"="1"
5126b"0""4"="1"
5127b"0""5"="1"
5128b"0""6"="2"
5129End Function
5130
5131Function matrixc
5132Matrix "c"
5133c.Create = "1,7"
5134c"0""0"="0"
5135c"0""1"="0"
5136c"0""2"="0"
5137c"0""3"="0"
5138c"0""4"="1"
5139c"0""5"="1"
5140c"0""6"="2"
5141End Function
5142
5143'signal classifier.
5144Function Layer
5145LayerNet "net"
5146net.Create = "64,2,0,2"
5147End Function
5148
5149Function matrixsig
5150Matrix "sig"
5151sig.Create = "2,32"
5152sig"0""0"="-1"
5153sig"0""1"="0"
5154sig"0""2"="1"
5155sig"0""3"="-1"
5156sig"0""4"="0"
5157sig"0""5"="1"
5158sig"0""6"="-1"
5159sig"0""7"="0"
5160sig"0""8"="1"
5161sig"0""9"="-1"
5162sig"0""10"="0"
5163sig"0""11"="-1"
5164sig"0""12"="0"
5165sig"0""13"="1"
5166sig"0""14"="-1"
5167sig"0""14"="0"
5168sig"0""16"="1"
5169sig"0""17"="-1"
5170sig"0""18"="0"
5171sig"0""19"="1"
5172sig"0""20"="-1"
5173sig"0""21"="0"
5174sig"0""22"="-1"
5175sig"0""23"="0"
5176sig"0""24"="1"
5177sig"0""25"="-1"
5178sig"0""26"="0"
5179sig"0""27"="1"
5180sig"0""28"="-1"
5181sig"0""29"="0"
5182sig"0""30"="1"
5183sig"0""31"="-1"
5184sig"1""0"="-1"
5185sig"1""1"="0"
5186sig"1""2"="1"
5187sig"1""3"="-1"
5188sig"1""4"="0"
5189sig"1""5"="1"
5190sig"1""6"="-1"
5191sig"1""7"="0"
5192sig"1""8"="1"
5193sig"1""9"="-1"
5194sig"1""10"="0"
5195sig"1""11"="-1"
5196sig"1""12"="0"
5197sig"1""13"="1"
5198sig"1""14"="-1"
5199sig"1""15"="0"
5200sig"1""16"="1"
5201sig"1""17"="-1"
5202sig"1""18"="0"
5203sig"1""19"="1"
5204sig"1""20"="-1"
5205sig"1""21"="0"
5206sig"1""22"="-1"
5207sig"1""23"="0"
5208sig"1""24"="1"
5209sig"1""25"="-1"
5210sig"1""26"="0"
5211sig"1""27"="1"
5212sig"1""28"="-1"
5213sig"1""29"="0"
5214sig"1""30"="0.0"
5215sig"1""31"="1.0"
5216End Function
5217
5218'noisy classifier and uniform distributed classifier.
5219Function Layer
5220LayerNet "net"
5221net.Create = "5,0,0,4"
5222End Function
5223
5224Function one
5225Matrix "one"
5226one.Create = "1,4"
5227one"0""0"="1"
5228one"0""1"="0"
5229one"0""2"="0"
5230one"0""3"="0"
5231End Function
5232
5233Function two
5234Matrix "two"
5235two.Create = "1,4"
5236two"0""0"="0"
5237two"0""1"="1"
5238two"0""2"="0"
5239two"0""3"="0"
5240End Function
5241
5242Function three
5243Matrix "three"
5244three.Create = "1,4"
5245three"0""0"="0"
5246three"0""1"="0"
5247three"0""2"="1"
5248three"0""3"="0"
5249End Function
5250
5251Function four
5252Matrix "four"
5253four.Create = "1,4"
5254four"0""0"="0"
5255four"0""1"="0"
5256four"0""2"="0"
5257four"0""3"="1"
5258End Function
5259
5260Function classifier
5261Matrix "classifier"
5262classifier.Create = "1,4"
5263classifier"0""0"="0"
5264classifier"0""1"="0"
5265classifier"0""2"="0"
5266classifier"0""3"="0"
5267End Function
5268
5269'shape classifier.
5270Function Layer
5271LayerNet "net"
5272net.Create = "64,12,0,2"
5273End Function
5274
5275Function matrixs
5276Matrix "s"
5277s.Create = "6,11"
5278s"0""0"="0"
5279s"0""1"="1"
5280s"0""2"="2"
5281s"0""3"="0"
5282s"0""4"="1"
5283s"0""5"="2"
5284s"0""6"="0"
5285s"0""7"="1"
5286s"0""8"="2"
5287s"0""9"="0"
5288s"0""10"="1"
5289s"1""0"="0"
5290s"1""1"="1"
5291s"1""2"="2"
5292s"1""3"="0"
5293s"1""4"="1"
5294s"1""5"="2"
5295s"1""6"="0"
5296s"1""7"="1"
5297s"1""8"="2"
5298s"1""9"="0"
5299s"1""10"="1"
5300s"2""0"="0"
5301s"2""1"="1"
5302s"2""2"="2"
5303s"2""3"="0"
5304s"2""4"="1"
5305s"2""5"="2"
5306s"2""6"="0"
5307s"2""7"="1"
5308s"2""8"="2"
5309s"2""9"="0"
5310s"2""10"="1"
5311s"3""0"="0"
5312s"3""1"="1"
5313s"3""2"="2"
5314s"3""3"="0"
5315s"3""4"="1"
5316s"3""5"="2"
5317s"3""6"="0"
5318s"3""7"="1"
5319s"3""8"="2"
5320s"3""9"="0"
5321s"3""10"="1"
5322s"4""0"="0"
5323s"4""1"="1"
5324s"4""2"="2"
5325s"4""3"="0"
5326s"4""4"="1"
5327s"4""5"="2"
5328s"4""6"="0"
5329s"4""7"="1"
5330s"4""8"="2"
5331s"4""9"="0"
5332s"4""10"="1"
5333s"5""0"="0"
5334s"5""1"="1"
5335s"5""2"="2"
5336s"5""3"="0"
5337s"5""4"="1"
5338s"5""5"="2"
5339s"5""6"="0"
5340s"5""7"="1"
5341s"5""8"="2"
5342s"5""9"="0.0"
5343s"5""10"="1.0"
5344End Function
5345
5346'simple introduction to prediction.
5347Function Prediction
5348Int "seriesLength" = "20"
5349Vector "numInputs"
5350numInputs.CreateSeries = "1.0,10.0,10"
5351Vector "numHid" = floor((seriesLength -numInputs)/(2.2*(1+numInputs)))
5352End Function
5353
5354'ProbabilisticneuralNetwork.
5355Function LayerNet
5356LayerNet "net"
5357net.Create = "5,5,5,3"
5358End Function
5359Function LayerNet
5360LayerNet "netT"
5361netT.Create = "5,5,5,4"
5362End Function
5363Function LayerNet
5364LayerNet "W"
5365W.Create = "5,0,0,1"
5366End Function
5367Function Matrix
5368MATRIX "X"
5369 X.Create = "3,5"
5370 X"0""0"="1"
5371 X"0""1"="2"
5372 X"0""2"="-8"
5373 X"0""3"="1.1"
5374 X"0""4"="-7.9"
5375 X"1""0"="4.0"
5376 X"1""1"="11"
5377 X"1""2"="7"
5378 X"1""3"="3.9"
5379 X"1""4"="7.1"
5380 X"2""0"="5"
5381 X"2""1"="-1"
5382 X"2""2"="6"
5383 X"2""3"="4.8"
5384 X"2""4"="5.9"
5385End Function
5386Function Matrix
5387MATRIX "T"
5388 T.Create = "4,5"
5389 T"0""0"="5"
5390 T"0""1"="4"
5391 T"0""2"="1"
5392 T"0""3"="5.1"
5393 T"0""4"="0.9"
5394 T"1""0"="6"
5395 T"1""1"="2"
5396 T"1""2"="1"
5397 T"1""3"="5.9"
5398 T"1""4"="0.8"
5399 T"2""0"="3"
5400 T"2""1"="1"
5401 T"2""2"="-1"
5402 T"2""3"="3"
5403 T"2""4"="-1.1"
5404 T"3""0"="2"
5405 T"3""1"="5"
5406 T"3""2"="-1"
5407 T"3""3"="2.1"
5408 T"3""4"="-1.0"
5409End Function
5410Function Vector
5411Vector "W"
5412 W.Create = "5"
5413 W"0"
5414 W"1"
5415 W"2"
5416 W"3"
5417 W"4"
5418End Function
5419Function Matrix
5420MATRIX "z"
5421 z = net.Run = "X"
5422 z = netT.Run = "T"
5423End Function
5424
5425'introduction to activation function.
5426Function activate
5427Vector "y"
5428y.CreateSeries = "10.0,10.0,100"
5429Vector "z"
5430z = 1.0/(1.0+ exp(-1.0*y))
5431End Function
5432
5433Function backpropagation
5434Vector "u"
5435u.Create = "3"
5436u"0.01"
5437u"0.97"
5438
5439Matrix "H"
5440H.Create = "2,3"
5441H"0""0"="0.93"
5442H"0""1"="-0.98"
5443H"0""2"="0.47"
5444H"1""0"="2.02"
5445H"1""1"="1.01"
5446H"1""2"="0.92"
5447
5448Vector "v" = "2"
5449v.Create = "2"
5450Vector "x" = "3"
5451x.Create = "3"
5452Matrix "W"
5453W.Create "1,3"
5454W"0""0"="1.51"
5455W"0""1"="-0.97"
5456W"0""2"="1.07"
5457
5458Vector "y" = "1"
5459y.Create = "1"
5460Vector "Z" = "1"
5461Z.Create = "1"
5462
5463int "i" = "2"
5464int "j" = "3"
5465t = "1.05"
5466mse = "0.062927"
5467delta = "0.0402645"
5468End Function
5469
5470Function KohoNet
5471KohoNet net
5472net.Create = "2,3,1"
5473End Function
5474Function Matrixa
5475Matrix "a"
5476a.Create = "3,2"
5477a"0""0"="1"
5478a"0""1"="0"
5479a"1""0"="0"
5480a"1""1"="1"
5481a"2""0"="2"
5482a"2""1"="3"
5483
5484net.AutoSetInScaler = "a"
5485End Function
5486
5487Function TrainSet
5488Matrix "TrainSet"
5489TrainSet.Create = "3,2"
5490TrainSet"0""0"="1"
5491TrainSet"0""1"="0"
5492TrainSet"1""0"="0"
5493TrainSet"1""1"="1"
5494TrainSet"2""0"="2"
5495TrainSet"2""1"="3"
5496
5497net.SetTrainingSet = "TrainSet,true"
5498net.TrainAdditive = "0.75,2"
5499net.TrainSubtractive = "0.5,2"
5500End Function
5501
5502
5503Function Prediction
5504Int seriesLenght = "20"
5505Vector numInputs
5506numInputs.CreateSeries = "1.0,10.0,10"
5507Vector numHid = floor((seriesLenght -numInputs)/(2.2*(1+numInputs)))
5508End Function
5509
5510Function ANN
5511 LayerNet net
5512net.Create = "8,0,0,4"
5513End Function
5514Function Matrix
5515 MATRIX "x"
5516 x.Create = "4,4"
5517 x"0""0"="-1.5"
5518 x"0""1"="2.5"
5519 x"0""2"="4.2"
5520 x"0""3"="8"
5521 x"1""0"="7.0"
5522 x"1""1"="3.9"
5523 x"1""2"="2.7"
5524 x"1""3"="11"
5525 x"2""0"="5.5"
5526 x"2""1"="6.0"
5527 x"2""2"="10"
5528 x"2""3"="0.5"
5529 x"3""0"="1.0"
5530 x"3""1"="1"
5531 x"3""2"="2"
5532 x"3""3"="9"
5533End Function
5534
5535Function Problem1
5536 MATRIX "w"
5537 w.Create = "3,2"
5538 w"0""0"="0"
5539 w"0""1"="1"
5540 w"1""0"="0"
5541 w"1""1"="1"
5542 w"2""0"="1"
5543 w"2""1"="1"
5544End Function
5545
5546Function Problem2
5547 MATRIX "y"
5548 y.Create = "4,2"
5549 y"0""0"="0"
5550 y"0""1"="0"
5551 y"1""0"="0"
5552 y"1""1"="1"
5553 y"2""0"="1"
5554 y"2""1"="0"
5555 y"3""0"="1"
5556 y"3""1"="1"
5557End Function
5558
5559Function Problem4
5560 MATRIX "e"
5561 e.Create = "2,2"
5562 e"0""0"="0"
5563 e"0""1"="0"
5564 e"1""0"="1"
5565 e"1""1"="1"
5566End Function
5567
5568Function Activation
5569 '----method 1.
5570 MATRIX "w"
5571 w.Create = "3,2"
5572 '----method 2.
5573 MATRIX "y"
5574 Math::oper::CreateMatrix = "y,2,3"
5575 '----method 3.
5576 MATRIX "e" = "3, valarray,<double>(2)"
5577 '----method 4.
5578 MATRIX "x" = "3,2"
5579 x.Create = "3,2"
5580End Function
5581
5582Function RunWhile
5583MATRIX Z
5584z = net.Run = "X"
5585End Function
5586
5587Function LayerNet
5588LayerNet "net"
5589net.Create = "2,0,0,1"
5590End Function
5591
5592Function Vectorj
5593Vector "j"
5594j.Create = "4"
5595j"1"
5596j"2"
5597j"3"
5598j"4"
5599End Function
5600
5601Function matrixx
5602Matrix "x"
5603x.Create = "4,2"
5604x"0""0"="0"
5605x"0""1"="0"
5606x"1""0"="0"
5607x"1""1"="1"
5608x"2""0"="1"
5609x"2""1"="0"
5610x"3""0"="1"
5611x"3""1"="1"
5612End Function
5613
5614Function matrixz
5615Matrix "z"
5616z.Create = "4,2"
5617z"0""0"="0"
5618z"0""1"="0"
5619z"1""0"="0"
5620z"1""1"="1"
5621z"2""0"="0"
5622z"2""1"="1"
5623z"3""0"="1"
5624z"3""1"="1"
5625End Function
5626
5627Function w
5628Matrix "w"
5629w.Create = "3,2"
5630w"0""0"="11"
5631w"0""1"="21"
5632w"1""0"="12"
5633w"1""1"="22"
5634w"2""0"="1"
5635w"2""1"="2"
5636End Function
5637
5638'multilayerANN.
5639Function LayerNet
5640LayerNet "net"
5641net.Create = "16,0,0,1"
5642End Function
5643
5644Function LayerNet
5645LayerNet "net2"
5646net2.Create = "6,0,0,1"
5647End Function
5648
5649Function Matrix
5650MATRIX "W"
5651W.Create = "1,16"
5652W"0""0"="0"
5653W"0""1"="1"
5654W"0""2"="2"
5655W"0""3"="0"
5656W"0""4"="1"
5657W"0""5"="2"
5658W"0""6"="0"
5659W"0""7"="1"
5660W"0""8"="2"
5661W"0""9"="0"
5662W"0""10"="1"
5663W"0""11"="2"
5664W"0""12"="0"
5665W"0""13"="1"
5666W"0""14"="2"
5667W"0""15"="0"
5668W"0""16"="1.0"
5669End Function
5670
5671Function Matrix
5672MATRIX "Y"
5673Y.Create = "1,6"
5674Y"0""0"="0"
5675Y"0""1"="2"
5676Y"0""2"="4"
5677Y"0""3"="6"
5678Y"0""4"="8"
5679Y"0""5"="10"
5680Y"0""6"="1.0"
5681End Function
5682
5683Function Matrix
5684MATRIX "z"
5685z = net.Run = "W"
5686z = net2.Run = "Y"
5687End Function
5688
5689'logic or gate.
5690Function LayerNet
5691 LayerNet "net"
5692 net.Create = "2,0,0,1"
5693End Function
5694
5695
5696'----create and set the ann weights
5697Function Matrix
5698 MATRIX "w"
5699 w.Create = "1,3"
5700 w"0""0"="20"
5701 w"0""1"="20"
5702 w"0""2"="10"
5703 net.SetWeights = "3, w"' layer Output Index = 3
5704End Function
5705
5706'---create the input
5707Function Matrix
5708 MATRIX "x1"
5709 x1.Create= "1,4"
5710 x1"0""0"="0"
5711 x1"0""1"="0"
5712 x1"0""2"="1"
5713 x1"0""3"="1"
5714End Function
5715
5716Function Matrix
5717 MATRIX "x2"
5718 x2.Create= "1,4"
5719 x2"0""0"="0"
5720 x2"0""1"="1"
5721 x2"0""2"="0"
5722 x2"0""3"="1"
5723End Function
5724
5725'logic and gate.
5726Function LayerNet
5727 LayerNet "net"
5728 net.Create = "2,0,0,1"
5729End Function
5730
5731'----create and set the ann weights
5732Function Matrix
5733 MATRIX "w"
5734 w.Create = "1,3"
5735 w"0""0"="20"
5736 w"0""1"="20"
5737 w"0""2"="10"
5738 net.SetWeights = "3, w"' layer Output Index = 3
5739End Function
5740
5741'---create the input
5742Function Matrix
5743 MATRIX "x"
5744 x.Create = "4,2"
5745 x"0""0"="0"
5746 x"0""1"="0"
5747 x"1""0"="0"
5748 x"1""1"="1"
5749 x"2""0"="1"
5750 x"2""1"="0"
5751 x"3""0"="1"
5752 x"3""1"="1"
5753End Function
5754
5755Function Matrix
5756 MATRIX "z"
5757 z = net.Run = "x"
5758End Function
5759
5760'logic not gate.
5761Function LayerNet
5762 LayerNet "net"
5763 net.Create = "1,0,0,1"
5764End Function
5765
5766Function Matrix
5767MATRIX "w"
5768 w.Create = "1,2"
5769 net.SetWeights = "3,w"
5770End Function
5771
5772Function Matrix
5773MATRIX "x"
5774 x.Create = "2,1"
5775 x"0""0"="0"
5776 x"1""0"="1"
5777End Function
5778
5779Function Matrix
5780 MATRIX "z"
5781 z = net.Run = "x"
5782End Function
5783
5784'logic Xor gate.
5785Function ANN
5786LayerNet "net"
5787net.Create = "2,1,0,1"
5788End Function
5789Function matrixx1
5790Matrix "x1"
5791x1.Create = "1,4"
5792x1"0""0"="0"
5793x1"0""1"="0"
5794x1"0""2"="1"
5795x1"0""3"="1"
5796End Function
5797Function matrixx2
5798Matrix "x2"
5799x2.Create = "1,4"
5800x2"0""0"="0"
5801x2"0""1"="1"
5802x2"0""2"="0"
5803x2"0""3"="1"
5804End Function
5805Function matrixz
5806Matrix "z"
5807z.Create = "1,4"
5808z"0""0"="0"
5809z"0""1"="1"
5810z"0""2"="1"
5811z"0""3"="0"
5812End Function
5813Function TrainSet
5814Matrix "TrainSet"
5815TrainSet.Create = "1,4"
5816TrainSet"0""0"="1"
5817TrainSet"0""1"="0"
5818TrainSet"0""2"="1"
5819TrainSet"0""3"="0"
5820End Function
5821Function DataSet
5822Matrix "DataSet"
5823DataSet.Create = "1,4"
5824DataSet"0""0"="0"
5825DataSet"0""1"="1"
5826DataSet"0""2"="0"
5827DataSet"0""3"="1"
5828End Function
5829Function ValidationSet
5830Matrix "ValidationSet"
5831ValidationSet.Create = "1,4"
5832ValidationSet"0""0"="0"
5833ValidationSet"0""1"="1"
5834ValidationSet"0""2"="1"
5835ValidationSet"0""3"="0"
5836End Function
5837
5838'Regression.
5839Function LayerNet
5840LayerNet "net"
5841net.Create = "2,0,0,1"
5842End Function
5843
5844Function Vectorj
5845Vector "j"
5846j.Create = "4"
5847j"1"
5848j"2"
5849j"3"
5850j"4"
5851End Function
5852
5853Function matrixx
5854Matrix "x"
5855x.Create = "4,2"
5856x"0""0"="0"
5857x"0""1"="0"
5858x"1""0"="0"
5859x"1""1"="1"
5860x"2""0"="1"
5861x"2""1"="0"
5862x"3""0"="1"
5863x"3""1"="1"
5864End Function
5865
5866Function matrixz
5867Matrix "z"
5868z.Create = "4,2"
5869z"0""0"="0"
5870z"0""1"="0"
5871z"1""0"="0"
5872z"1""1"="1"
5873z"2""0"="0"
5874z"2""1"="1"
5875z"3""0"="1"
5876z"3""1"="1"
5877End Function
5878
5879Function w
5880Matrix "w"
5881w.Create = "3,2"
5882w"0""0"="11"
5883w"0""1"="21"
5884w"1""0"="12"
5885w"1""1"="22"
5886w"2""0"="1"
5887w"2""1"="2"
5888End Function
5889
5890'Backpropagation.
5891Function backpropagation
5892Vector "u"
5893u.Create = "3"
5894u"0.01"
5895u"0.97"
5896
5897Matrix "H"
5898H.Create = "2,3"
5899H"0""0"="0.93"
5900H"0""1"="-0.98"
5901H"0""2"="0.47"
5902H"1""0"="2.02"
5903H"1""1"="1.01"
5904H"1""2"="0.92"
5905
5906Vector "v" = "2"
5907v.Create = "2"
5908Vector "x" = "3"
5909x.Create = "3"
5910Matrix "W"
5911W.Create "1,3"
5912W"0""0"="1.51"
5913W"0""1"="-0.97"
5914W"0""2"="1.07"
5915
5916Vector "y" = "1"
5917y.Create = "1"
5918Vector "Z" = "1"
5919Z.Create = "1"
5920
5921int "i" = "2"
5922int "j" = "3"
5923t = "1.25"
5924mse = "0.062927"
5925delta = "0.0402645"
5926End Function
5927
5928'Fruit classifier.
5929Function KohoNet
5930KohoNet "net"
5931net.Create = "2,3,1"
5932End Function
5933Function Matrixa
5934Matrix "a"
5935a.Create = "3,2"
5936a"0""0"="1"
5937a"0""1"="0"
5938a"1""0"="0"
5939a"1""1"="1"
5940a"2""0"="2"
5941a"2""1"="3"
5942
5943net.AutoSetInScaler = "a"
5944
5945Matrix "b" = Run = "a"
5946End Function
5947
5948Function TrainSet
5949Matrix "TrainSet"
5950TrainSet.Create = "3,2"
5951TrainSet"0""0"="1"
5952TrainSet"0""1"="0"
5953TrainSet"1""0"="0"
5954TrainSet"1""1"="1"
5955TrainSet"2""0"="2"
5956TrainSet"2""1"="3"
5957
5958net.SetTrainingSet = "TrainSet,true"
5959net.TrainAdditive = "0.75,2"
5960net.TrainSubtractive = "0.5,2"
5961End Function
5962
5963'Numeric classifier.
5964Function network
5965KohoNet "net"
5966net.Create = "5,2,1"
5967End Function
5968
5969Function matrixa
5970Matrix "a"
5971a.Create = "1,7"
5972a"0""0"="0"
5973a"0""1"="0"
5974a"0""2"="1"
5975a"0""3"="0"
5976a"0""4"="1"
5977a"0""5"="1"
5978a"0""6"="2"
5979End Function
5980
5981Function matrixb
5982Matrix "b"
5983b.Create = "1,7"
5984b"0""0"="0"
5985b"0""1"="0"
5986b"0""2"="1"
5987b"0""3"="1"
5988b"0""4"="1"
5989b"0""5"="1"
5990b"0""6"="2"
5991End Function
5992
5993Function matrixc
5994Matrix "c"
5995c.Create = "1,7"
5996c"0""0"="0"
5997c"0""1"="0"
5998c"0""2"="0"
5999c"0""3"="0"
6000c"0""4"="1"
6001c"0""5"="1"
6002c"0""6"="2"
6003End Function
6004
6005'signal classifier.
6006Function Layer
6007LayerNet "net"
6008net.Create = "64,2,0,2"
6009End Function
6010
6011Function matrixsig
6012Matrix "sig"
6013sig.Create = "2,32"
6014sig"0""0"="-1"
6015sig"0""1"="0"
6016sig"0""2"="1"
6017sig"0""3"="-1"
6018sig"0""4"="0"
6019sig"0""5"="1"
6020sig"0""6"="-1"
6021sig"0""7"="0"
6022sig"0""8"="1"
6023sig"0""9"="-1"
6024sig"0""10"="0"
6025sig"0""11"="-1"
6026sig"0""12"="0"
6027sig"0""13"="1"
6028sig"0""14"="-1"
6029sig"0""14"="0"
6030sig"0""16"="1"
6031sig"0""17"="-1"
6032sig"0""18"="0"
6033sig"0""19"="1"
6034sig"0""20"="-1"
6035sig"0""21"="0"
6036sig"0""22"="-1"
6037sig"0""23"="0"
6038sig"0""24"="1"
6039sig"0""25"="-1"
6040sig"0""26"="0"
6041sig"0""27"="1"
6042sig"0""28"="-1"
6043sig"0""29"="0"
6044sig"0""30"="1"
6045sig"0""31"="-1"
6046sig"1""0"="-1"
6047sig"1""1"="0"
6048sig"1""2"="1"
6049sig"1""3"="-1"
6050sig"1""4"="0"
6051sig"1""5"="1"
6052sig"1""6"="-1"
6053sig"1""7"="0"
6054sig"1""8"="1"
6055sig"1""9"="-1"
6056sig"1""10"="0"
6057sig"1""11"="-1"
6058sig"1""12"="0"
6059sig"1""13"="1"
6060sig"1""14"="-1"
6061sig"1""15"="0"
6062sig"1""16"="1"
6063sig"1""17"="-1"
6064sig"1""18"="0"
6065sig"1""19"="1"
6066sig"1""20"="-1"
6067sig"1""21"="0"
6068sig"1""22"="-1"
6069sig"1""23"="0"
6070sig"1""24"="1"
6071sig"1""25"="-1"
6072sig"1""26"="0"
6073sig"1""27"="1"
6074sig"1""28"="-1"
6075sig"1""29"="0"
6076sig"1""30"="0.0"
6077sig"1""31"="1.0"
6078End Function
6079
6080'noisy classifier and uniform distributed classifier.
6081Function Layer
6082LayerNet "net"
6083net.Create = "5,0,0,4"
6084End Function
6085
6086Function one
6087Matrix "one"
6088one.Create = "1,4"
6089one"0""0"="1"
6090one"0""1"="0"
6091one"0""2"="0"
6092one"0""3"="0"
6093End Function
6094
6095Function two
6096Matrix "two"
6097two.Create = "1,4"
6098two"0""0"="0"
6099two"0""1"="1"
6100two"0""2"="0"
6101two"0""3"="0"
6102End Function
6103
6104Function three
6105Matrix "three"
6106three.Create = "1,4"
6107three"0""0"="0"
6108three"0""1"="0"
6109three"0""2"="1"
6110three"0""3"="0"
6111End Function
6112
6113Function four
6114Matrix "four"
6115four.Create = "1,4"
6116four"0""0"="0"
6117four"0""1"="0"
6118four"0""2"="0"
6119four"0""3"="1"
6120End Function
6121
6122Function classifier
6123Matrix "classifier"
6124classifier.Create = "1,4"
6125classifier"0""0"="0"
6126classifier"0""1"="0"
6127classifier"0""2"="0"
6128classifier"0""3"="0"
6129End Function
6130
6131'shape classifier.
6132Function Layer
6133LayerNet "net"
6134net.Create = "64,12,0,2"
6135End Function
6136
6137Function matrixs
6138Matrix "s"
6139s.Create = "6,11"
6140s"0""0"="0"
6141s"0""1"="1"
6142s"0""2"="2"
6143s"0""3"="0"
6144s"0""4"="1"
6145s"0""5"="2"
6146s"0""6"="0"
6147s"0""7"="1"
6148s"0""8"="2"
6149s"0""9"="0"
6150s"0""10"="1"
6151s"1""0"="0"
6152s"1""1"="1"
6153s"1""2"="2"
6154s"1""3"="0"
6155s"1""4"="1"
6156s"1""5"="2"
6157s"1""6"="0"
6158s"1""7"="1"
6159s"1""8"="2"
6160s"1""9"="0"
6161s"1""10"="1"
6162s"2""0"="0"
6163s"2""1"="1"
6164s"2""2"="2"
6165s"2""3"="0"
6166s"2""4"="1"
6167s"2""5"="2"
6168s"2""6"="0"
6169s"2""7"="1"
6170s"2""8"="2"
6171s"2""9"="0"
6172s"2""10"="1"
6173s"3""0"="0"
6174s"3""1"="1"
6175s"3""2"="2"
6176s"3""3"="0"
6177s"3""4"="1"
6178s"3""5"="2"
6179s"3""6"="0"
6180s"3""7"="1"
6181s"3""8"="2"
6182s"3""9"="0"
6183s"3""10"="1"
6184s"4""0"="0"
6185s"4""1"="1"
6186s"4""2"="2"
6187s"4""3"="0"
6188s"4""4"="1"
6189s"4""5"="2"
6190s"4""6"="0"
6191s"4""7"="1"
6192s"4""8"="2"
6193s"4""9"="0"
6194s"4""10"="1"
6195s"5""0"="0"
6196s"5""1"="1"
6197s"5""2"="2"
6198s"5""3"="0"
6199s"5""4"="1"
6200s"5""5"="2"
6201s"5""6"="0"
6202s"5""7"="1"
6203s"5""8"="2"
6204s"5""9"="0.0"
6205s"5""10"="1.0"
6206End Function
6207
6208'simple introduction to prediction.
6209Function Prediction
6210Int "seriesLength" = "520"
6211Vector "numInputs"
6212numInputs.CreateSeries = "1.0,10.0,10"
6213Vector "numHid" = floor((seriesLength -numInputs)/(2.2*(1+numInputs)))
6214End Function
6215
6216'ProbabilisticneuralNetwork.
6217Function LayerNet
6218LayerNet "net"
6219net.Create = "5,5,5,3"
6220End Function
6221Function LayerNet
6222LayerNet "netT"
6223netT.Create = "5,5,5,4"
6224End Function
6225Function LayerNet
6226LayerNet "W"
6227W.Create = "5,0,0,1"
6228End Function
6229Function Matrix
6230MATRIX "X"
6231 X.Create = "3,5"
6232 X"0""0"="1"
6233 X"0""1"="2"
6234 X"0""2"="-8"
6235 X"0""3"="1.1"
6236 X"0""4"="-7.9"
6237 X"1""0"="4.0"
6238 X"1""1"="11"
6239 X"1""2"="7"
6240 X"1""3"="3.9"
6241 X"1""4"="7.1"
6242 X"2""0"="5"
6243 X"2""1"="-1"
6244 X"2""2"="6"
6245 X"2""3"="4.8"
6246 X"2""4"="5.9"
6247End Function
6248Function Matrix
6249MATRIX "T"
6250 T.Create = "4,5"
6251 T"0""0"="5"
6252 T"0""1"="4"
6253 T"0""2"="1"
6254 T"0""3"="5.1"
6255 T"0""4"="0.9"
6256 T"1""0"="6"
6257 T"1""1"="2"
6258 T"1""2"="1"
6259 T"1""3"="5.9"
6260 T"1""4"="0.8"
6261 T"2""0"="3"
6262 T"2""1"="1"
6263 T"2""2"="-1"
6264 T"2""3"="3"
6265 T"2""4"="-1.1"
6266 T"3""0"="2"
6267 T"3""1"="5"
6268 T"3""2"="-1"
6269 T"3""3"="2.1"
6270 T"3""4"="-1.0"
6271End Function
6272Function Vector
6273Vector "W"
6274 W.Create = "5"
6275 W"0"
6276 W"1"
6277 W"2"
6278 W"3"
6279 W"4"
6280End Function
6281Function Matrix
6282MATRIX "z"
6283 z = net.Run = "X"
6284 z = netT.Run = "T"
6285End Function
6286
6287Rem PLUGIN: PLUGINAREA1
6288
6289'DREAMOUTLOUD, REDIRECT RESPONSE ALGORITHM.
6290'DREAMOUTLOUD, COLLECT ALL RESPONSES FROM DEFAULT BRAIN SO ALL RESPONSES CAN BE CONVERTED TO RELEVENCE HANDLING.
6291If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6292Rem PLUGIN: PLUGINAREA2
6293If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6294Rem PLUGIN: PLUGINAREA3
6295If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6296Rem PLUGIN: PLUGINAREA4
6297If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6298Rem PLUGIN: PLUGINAREA5
6299If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6300Rem PLUGIN: PLUGINAREA6
6301If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6302Rem PLUGIN: PLUGINAREA7
6303If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6304Rem PLUGIN: PLUGINAREA8
6305If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6306Rem PLUGIN: PLUGINAREA9
6307If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6308Rem PLUGIN: PLUGINAREA10
6309If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6310Rem PLUGIN: PLUGINAREA11
6311If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6312Rem PLUGIN: PLUGINAREA12
6313If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6314Rem PLUGIN: PLUGINAREA13
6315If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6316Rem PLUGIN: PLUGINAREA14
6317If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6318Rem PLUGIN: PLUGINAREA15
6319If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6320Rem PLUGIN: PLUGINAREA16
6321If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6322Rem PLUGIN: PLUGINAREA17
6323If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6324Rem PLUGIN: PLUGINAREA18
6325If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6326Rem PLUGIN: PLUGINAREA19
6327If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6328Rem PLUGIN: PLUGINAREA20
6329If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6330Rem PLUGIN: PLUGINAREA21
6331If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6332Rem PLUGIN: PLUGINAREA22
6333If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6334Rem PLUGIN: PLUGINAREA23
6335If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6336Rem PLUGIN: PLUGINAREA24
6337If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6338Rem PLUGIN: PLUGINAREA25
6339If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6340Rem PLUGIN: PLUGINAREA26
6341If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6342Rem PLUGIN: PLUGINAREA27
6343If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6344Rem PLUGIN: PLUGINAREA28
6345If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6346Rem PLUGIN: PLUGINAREA29
6347If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6348Rem PLUGIN: PLUGINAREA30
6349If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6350Rem PLUGIN: PLUGINAREA31
6351If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6352Rem PLUGIN: PLUGINAREA32
6353If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6354Rem PLUGIN: PLUGINAREA33
6355If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6356Rem PLUGIN: PLUGINAREA34
6357If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6358Rem PLUGIN: PLUGINAREA35
6359If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6360Rem PLUGIN: PLUGINAREA36
6361If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6362Rem PLUGIN: PLUGINAREA37
6363If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6364Rem PLUGIN: PLUGINAREA38
6365If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6366Rem PLUGIN: PLUGINAREA39
6367If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6368Rem PLUGIN: PLUGINAREA40
6369If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6370Rem PLUGIN: PLUGINAREA41
6371If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6372Rem PLUGIN: PLUGINAREA42
6373If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6374Rem PLUGIN: PLUGINAREA43
6375If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6376Rem PLUGIN: PLUGINAREA44
6377If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6378Rem PLUGIN: PLUGINAREA45
6379If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6380Rem PLUGIN: PLUGINAREA46
6381If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6382Rem PLUGIN: PLUGINAREA47
6383If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6384Rem PLUGIN: PLUGINAREA48
6385If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6386Rem PLUGIN: PLUGINAREA49
6387If Len(GetResponse) > 2 Then HalBrain.AddToTable "DREAMOUTLOUD", "Brain", " " & Trim(Ucase(GetResponse)), "@" & Trim(Ucase(GetResponse))
6388
6389'S.A.L.L.I.E's, REDIRECT RESPONSE ALGORITHM
6390If UserBrainRel = "" Then UserBrainRel = 0
6391If UserSentence <> "" Then ResponseHandler = HalBrain.QABrain(UserSentence, "DREAMOUTLOUD", UserBrainRel)
6392If Len(ResponseHandler) > 1 And UserBrainRel <> 0 Then GetResponse = ResponseHandler
6393
6394'TRUNCATE TABLE
6395'DROP TABLE
6396'DELETE TABLE
6397Dim DelGRTable()
6398 If HalBrain.CheckTableExistence("DREAMOUTLOUD") = True And UserBrainRel = 0 Then HalBrain.RunQuery "DROP TABLE " & "DREAMOUTLOUD", DelGRTable
6399 If HalBrain.CheckTableExistence("DREAMOUTLOUD") = False Then
6400 HalBrain.CreateTable "Sallie", "Brain", ""
6401 End If
6402
6403Rem PLUGIN: PLUGINAREA6
6404
6405ParseRepeat = OriginalSentence
6406If InStr(1, ParseRepeat, "PLEASE REPEAT THE LAST MESSAGE", 1) > 0 Or InStr(1, ParseRepeat, "REPEAT THAT", 1) > 0 Or InStr(1, ParseRepeat, "PLEASE SAY THAT AGAIN", 1) > 0 Then
6407Select Case HalBrain.RandomNum(7)
6408Case 1
6409ReptStrt = "I just said: "
6410Case 2
6411ReptStrt = "I'll say that again. "
6412Case 3
6413ReptStrt = "I'm sorry you didn't hear me, I said: "
6414Case 4
6415ReptStrt = "I said: "
6416Case 5
6417ReptStrt = "Okay. "
6418Case 6
6419ReptStrt = "Alright. "
6420Case 7
6421ReptStrt = "I'm sorry if I wasn't clear, I said: "
6422End Select
6423GetResponse = ReptStrt & Prevsent & vbCrLf
6424HalBrain.ReadOnlyMode = True
6425End If
6426
6427'Word Power List.
6428AlreadyWritten = HalBrain.TopicSearch(OriginalSentence, WorkingDir & "Word_Power.brn")
6429Repeat = False
6430If AlreadyWritten <> "" Then Repeat = True
6431GetAWord = HalBrain.ChooseSentenceFromFile(WorkingDir & "Word_Extract.brn")
6432If Repeat = False And RND > 0 Then HalBrain.AppendFile WorkingDir & "Word_Power.brn", """" & " " & GetAWord & " " & """,""" & " " & GetAWord & " " & """"
6433GetAWord2 = HalBrain.ChooseSentenceFromFile(WorkingDir & "Word_Extract_2.brn")
6434If Repeat = False And RND > 0 Then HalBrain.AppendFile WorkingDir & "Word_Power.brn", """" & " " & GetAWord2 & " " & """,""" & " " & GetAWord2 & " " & """"
6435
6436'Save to Word List file.
6437If Len(UserSentence) > 12 Then
6438FilUserSentence = HalBrain.AlphaNumericalOnly(UserSentence)
6439ListedWords = Replace(FilUserSentence, " ", " " & ListedWords & """,""" & "TRUE" & """" & vbCrLf & """" & " ", 1, -1, vbTextCompare)
6440HalBrain.AppendFile WorkingDir & "Word_List.brn", """" & " " & ListedWords & " " & """,""" & "TRUE" & """"
6441End If
6442
6443'Word formatter 1
6444If Len(UserSentence) > 12 Then
6445FilUserSentence = HalBrain.AlphaNumericalOnly(UserSentence)
6446FilUserSentence = HalBrain.RemovePronouns(UserSentence)
6447Testing = Replace(FilUserSentence, " ", vbCrLf, 1, -1, vbTextCompare)
6448HalBrain.AppendFile WorkingDir & "Word_Extract.brn", Testing
6449End If
6450
6451'Word formatter 2
6452If Len(UserSentence) > 12 Then
6453FilUserSentence = HalBrain.AlphaNumericalOnly(UserSentence)
6454FilUserSentence = HalBrain.RemovePronouns(UserSentence)
6455Testing = Replace(FilUserSentence, " ", vbCrLf, 1, -1, vbTextCompare)
6456HalBrain.AppendFile WorkingDir & "Word_Extract_2.brn", Testing
6457End If
6458
6459'BANNING/FILTER FOR SENTENCES OR STATEMENTS.
6460If PrevSent <> "" And InStr(1, UserSentence, "NEVER SAY THAT AGAIN ", vbTextCompare) > 0 Then
6461 HalBrain.AddToTable "BannedResponses", "TopicSearch", PrevSent, "" & "<Banned>"
6462 HalBrain.ReadOnlyMode = True
6463 GetResponse = " I am sorry " & UserName & ". "
6464End If
6465
6466'BANNING/FILTER FOR SENTENCES OR STATEMENTS.
6467If PrevSent <> "" And InStr(1, UserSentence, "Stop saying that", vbTextCompare) > 0 Then
6468 HalBrain.AddToTable "BannedResponses", "TopicSearch", PrevSent, "" & "<Banned>"
6469 HalBrain.ReadOnlyMode = True
6470 GetResponse = " I am sorry " & UserName & ". "
6471End If
6472
6473
6474'HAL WILL FIND SOMETHING TO SAY RELEVENT TO FORGETTING
6475If HalBrain.TopicSearch(GetResponse, "BannedResponses") = "<Banned>" Then GetResponse = " I forgot what I was going to say " & UserName & ". "
6476If InStr(1, PrevSent, " I forgot what I was going to say ", vbTextCompare) > 0 And Not _
6477 HalBrain.TopicSearch(GetResponse, "BannedResponses") = "<Banned>" Then GetResponse = HalUserBrain & vbCrLf