I started writing a plugin to limit the database searches, my frist thought was what would I like her to do, do a wiki search, how would I say it " Do a wiki search for elephant. " So we limit it by saying " wiki search " if thats not there it skips the whole thing. Next to deal with the IsQuestion I changed and added some words for the user sentence. I also made the change Cload had suggested.
Next to see what was going on I put the scrip into the brain editor. This is what I have.
'RESPOND: LOCAL WIKIPEDIA
'Responds with a fact from the wikipedi abstract database
If InStr(1, OriginalSentence, "wiki search ", vbTextCompare) > 0 Then
LearningLevel = 0
GetResponse = HalBrain.HalFormat(GetResponse)
SourceData = ""
HighestRelSource = ""
IsQuestion = False
If InStr(1, OriginalSentence, "for", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "on", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "about", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "Who ", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "What ", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "When ", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "Where ", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "Why ", vbTextCompare) > 0 Then IsQuestion = True
If InStr(1, OriginalSentence, "How ", vbTextCompare) > 0 Then IsQuestion = True
If Len(GetResponse) < 4 And IsQuestion = True And Instr(1, OriginalSentence, "YOU", vbTextCompare) = 0 Then
Set HalWiki = CreateObject("UltraHalAsst6.Brain")
HalWiki.OpenDatabase "wikipedia.db"
UserBrainRel = 0
WikiSearch = HalBrain.ExtractKeywords(UserSentence)
HalUserBrain = HalWiki.QABrain(WikiSearch, "wiki", UserBrainRel)
If HalWiki.CheckRepetition(HalUserBrain, UserSentence) = True Or HalWiki.CheckRepetition(HalUserBrain, PrevSent) = True Or HalWiki.CheckRepetition(HalUserBrain, PrevUserSent) = True Then UserBrainRel = 0
If UserBrainRel < 82 Then UserBrainRel = 0
If UserBrainRel > HighestRel Then
HighestRel = UserBrainRel
HighestRelResponse = HalUserBrain
End If
End If
Score = UserBrainRel + 1
Hurdle = GainControl / 3
If Len(GetResponse) < 4 And Score > Hurdle Then
GetResponse = GetResponse & HalUserBrain & " . " & vbCrLf
SkipOpinion = True
AvoidBeingFlag = True
End If
HalWiki.CloseDatabase
Set HalWiki = Nothing
End If
HalBrain.DebugWatch GetResponse, "Wikipedia Brain" & SourceData
The brain works I do have problems, for " do a wiki search for New England." The current subject is search and not New England. I've played with this and gotten different results, also noticed she keeps track of the searches in the auto learning which I'd like to stop.
Any help or suggestions appreciated.
Carl2