17
« on: August 23, 2003, 08:08:16 pm »
This seems to pick up other things as well... but the file is of a managable size... So what is it??? Well, my bot gives off the wall generic answers to personal questions - next time it gets these questions, I can go into PersonalQuestions.brn and edit the answers the bot will give the next time it gets that question. If it finds an answer, it won't keep adding to the file...
'Will you please just answer the question?
OpenQuest = False
If InStr(1, UserSentence, " WHAT ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " WHERE ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " WHY ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " WHO ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " WHEN ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " HOW ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " TELL YOU ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " TELL ME ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " TO KNOW ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " TO HEAR ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " TO LEARN ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " FIND OUT ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " AM I ", 1) > 0 Then OpenQuest = True
If InStr(1, UserSentence, " FAVORITE ", 1) > 0 Then OpenQuest = False
If OpenQuest = True Then
If InStr(1, UserSentence, " MY ", 1) > 0 Or InStr(1, UserSentence, " AM I ", 1) > 0 Then AboutMy = True
If OpenQuest = True And AboutMy = True Then
HalUserBrain = HalBrain.QABrain(UserSentence, WorkingDir & "PersonalQuestions" & ".brn", UserBrainRel)
Pass = False
If HalBrain.CheckRepetition(HalUserBrain, UserSentence) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevSent) = True Or HalBrain.CheckRepetition(HalUserBrain, PrevUserSent) = True Then Pass = True
If Pass = False then
If UserBrainRel > 75 Then
'found an answer
GetResponse = GetResponse & HalUserBrain & vbCrLf
BlockSave = True
Else
'save the question since it can't find an answer we'll just fix it manually later
AnswerSent = "@" & OriginalSentence
QuestionSent = " " & Trim(HalBrain.ExtractKeywords(UserSentence))
If HalBrain.CountInstances(" ", QuestionSent) > 2 Then HalBrain.AppendFile WorkingDir & "PersonalQuestions" & ".brn", AnswerSent & vbCrLf & QuestionSent
UserBrainRel = 0
End If
End If
End If
End If
BTW - you probably should create PersonalQuestions.brn... I've heard if it don't exist, it will be created automatically, but I don't know.