Author Topic: To Rob, Additional MainQA scripting.  (Read 2314 times)

onthecuttingedge2005

  • Guest
To Rob, Additional MainQA scripting.
« on: September 15, 2005, 01:20:23 pm »
Hi Rob.

Can you take a look at my programming and see if you can utilize it for HAL 6, I wanted to pass it along before you released the next version incase there was something you can take advantage of in it.

This is one version of MainQA response from Ziggy Pro Bot series.

Code: [Select]
'ZIGGY PRO BOT, develope a response from its meaning.
'This is a plug-in script for HAL 6 or greater only.
'Find the best floating UserBrainRel
'and produce a response from its wordnet meaning.
'Remove punctuation for detection.
FilHalResp = HalBrain.AlphaNumericalOnly(GetResponse)
FilPrevHalResp = HalBrain.AlphaNumericalOnly(PrevSent)
FilUserResp = HalBrain.AlphaNumericalOnly(UserSentence)
FilPrevUserResp = HalBrain.AlphaNumericalOnly(PrevUserSent)
FilOrigResp = HalBrain.AlphaNumericalOnly(OriginalSentence)
'Make all upper case for detection.
'Alike sentences will equal 100.
If UserBrainRel = "" Then UserBrainRel = 0
If Trim(UCase(FilUserResp)) = Trim(UCase(FilHalResp)) Then UserBrainRel = 100
If Trim(UCase(FilPrevUserResp)) = Trim(UCase(FilHalResp)) Then UserBrainRel = 100
If Trim(UCase(FilOrigResp)) = Trim(UCase(FilHalResp)) Then UserBrainRel = 100
If Trim(UCase(FilPrevHalResp)) = Trim(UCase(FilHalResp)) Then UserBrainRel = 100
'If UserBrainRel is within this best floating point then get a response.
'UserBrainRel = 0 are not exactly the same.
'UserBrainRel = 50 is 50% the same.
'UserBrainRel = 100 are exactly the same. (repeating).
If CurrentSubject = "" Then CurrentSubject = wn.FindFirstNoun(UserSentence, True)
If wn.LookUpWord(CurrentSubject) = True Then
If SeeMeaning = "" Then SeeMeaning = wn.GetDefinition(wn.GuessPartOfSpeech, 1, "D")
If SeeMeaning = "" Then SeeMeaning = wn.GetDefinition(wn.GuessPartOfSpeech, 1, "S")
If SeeMeaning = "" Then SeeMeaning = wn.GetDefinition(wn.GuessPartOfSpeech, 1, "E")
     Common1 = HalBrain.QABrain(UserSentence, "mainQA", UserBrainRel)
     Common2 = HalBrain.QABrain(UserSentence, "mainQA", UserBrainRel)
     Common3 = HalBrain.QABrain(UserSentence, "mainQA", UserBrainRel)
'DebugInfo = DebugInfo & "What does it mean: " & SeeMeaning & vbCrLf
If (UserBrainRel >= 1 And UserBrainRel <= 99) Then
     anArray = Array(Common1,Common2,Common3)
     For Each arrayElement In anArray
     If ((Instr(1, Trim(UCase(UserSentence)), Trim(UCase(CurrentSubject)), vbTextCompare) > 0) Or (Instr(1, Trim(UCase(UserSentence)), Trim(UCase(SeeMeaning)), vbTextCompare) > 0)) Then
     GetResponse = arrayElement
     'DebugInfo = DebugInfo & "Best floating Relevence was: " & UserBrainRel & " And GetResponse was: " & GetResponse & vbCrLf
     Exit For
     End If
     Next
     End If
     End If

If you want some more ideas just peek into my websites premium download area, There is a Ziggy Pro Bot Sample package there with all kinds of goodies building up and is added too until it becomes a completed project.

Jerry.[8D]