31
Ultra Hal 7.0 / General Knowledge plug in.
« on: November 12, 2005, 09:16:55 am »
Thank you for the link. I donwnloaded and installed it and thehn went on to install the general and trivial knowledge brain plug in and asked the same question...
What can you tell me about dogs and cats?
And still I got no reply mentioning relevance. Am I doing something wrong here?
I pasted the script in right after the RESPOND: CALL CAPITALS FUNCTIONS and bfore the RESPOND: DICTIONARY FUNCTION in the script:
'RESPOND: CALL CAPITALS FUNCTIONS
'These 2 functions answer questions about US and World Capitals. The functions are built in to the DLL.
'We add a qualifying word to reduce false triggering of these two functions.
If InStr(UserSentence, "WHAT") > 0 Or InStr(UserSentence, "WHERE") > 0 Then
If Len(HalBrain.USCaps(UserSentence)) > 4 Then
Capitals = Trim(HalBrain.USCaps(UserSentence))
End If
If Len(HalBrain.WorldCaps(UserSentence)) > 4 Then
Capitals = Trim(HalBrain.WorldCaps(UserSentence))
End If
'=vonsmith= Added GetResponseBlock
If Capitals <> "" And GetResponseBlock <> True Then
GetResponse = GetResponse & Capitals & " . " & VbCrLf
DebugInfo = DebugInfo & "The user was asking about a capital and Hal has given him the answer: " & Capitals & VbCrLf
End If
End If
'The "RESPOND: CALL CAPITALS FUNCTIONS" function should precede this.
'XTF Brain v1.4 Related Start
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'PROCESS: HAL "GENERAL & TRIVIAL KNOWLEDGE" FUNCTION
'(c) 2004 Scott Higgins. Portions of this script are copyright by Scott Higgins, aka: =vonsmith=
'This script shall not be sold or used for any purpose unless specifically authorized by the author
'in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
'This is an entirely new function written by =vonsmith= , version 12-14-04a.
'
'This function searches a general knowledge and trivia file for information relevant to the user's request.
'
If (InStr(1, UserSentence, " WHAT CAN I TELL YOU ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT ELSE CAN I TELL YOU ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT ELSE DO I KNOW ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT DO I KNOW ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " TELL YOU SOMETHING ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " TELL YOU SOMETHING ELSE ABOUT ", vbTextCompare) > 0) And GetResponseBlock <> True Then
InfoStart = 0
InfoStart = InStr(1, UserSentence, " ABOUT ", vbTextCompare) + Len(" ABOUT ")
InfoEnd = Len(UserSentence)
InfoRequest = Mid(UserSentence, InfoStart, (InfoEnd - InfoStart)) 'Extract requested info phrase.
InfoRequest = " " & HalBrain.AlphaNumericalOnly(InfoRequest) & " "
HalInfoBrain = HalBrain.QABrain(InfoRequest, WorkingDir & "XTF_SYS_GeneralInfo.brn", InfoBrainRel)
If InfoBrainRel > 15 And InfoBrainRel < 25 Then
GetResponse = " You might not think this is relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
ElseIf InfoBrainRel > 24 And InfoBrainRel < 45 Then
GetResponse = " I think this may be relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
ElseIf InfoBrainRel > 44 Then
GetResponse = " This seems very relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
Else
GetResponse = " Sorry, I can't think of anything relevant. " & VbCrLf
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
End If
BlockSave = True
End If
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'XTF Brain v1.4 Related End
'The "RESPOND: DICTIONARY FUNCTION" function should follow this.
'RESPOND: DICTIONARY FUNCTION
'If the user asks Hal to define a word, then access wordnet and define it
If WordToLookup = "" Then WordToLookup =
If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "PLEASE DEFINE *", 1)
If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "DEFINE *", 1)
If WordToLookup = "" Then WordToLookup =
HalBrain.SearchPattern(UserSentence, "* DEFINITION OF *", 2)
---------------------------------------------------------------------
I should get a respond about relevance when I have this installed right?
What can you tell me about dogs and cats?
And still I got no reply mentioning relevance. Am I doing something wrong here?
I pasted the script in right after the RESPOND: CALL CAPITALS FUNCTIONS and bfore the RESPOND: DICTIONARY FUNCTION in the script:
'RESPOND: CALL CAPITALS FUNCTIONS
'These 2 functions answer questions about US and World Capitals. The functions are built in to the DLL.
'We add a qualifying word to reduce false triggering of these two functions.
If InStr(UserSentence, "WHAT") > 0 Or InStr(UserSentence, "WHERE") > 0 Then
If Len(HalBrain.USCaps(UserSentence)) > 4 Then
Capitals = Trim(HalBrain.USCaps(UserSentence))
End If
If Len(HalBrain.WorldCaps(UserSentence)) > 4 Then
Capitals = Trim(HalBrain.WorldCaps(UserSentence))
End If
'=vonsmith= Added GetResponseBlock
If Capitals <> "" And GetResponseBlock <> True Then
GetResponse = GetResponse & Capitals & " . " & VbCrLf
DebugInfo = DebugInfo & "The user was asking about a capital and Hal has given him the answer: " & Capitals & VbCrLf
End If
End If
'The "RESPOND: CALL CAPITALS FUNCTIONS" function should precede this.
'XTF Brain v1.4 Related Start
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'PROCESS: HAL "GENERAL & TRIVIAL KNOWLEDGE" FUNCTION
'(c) 2004 Scott Higgins. Portions of this script are copyright by Scott Higgins, aka: =vonsmith=
'This script shall not be sold or used for any purpose unless specifically authorized by the author
'in writing. Personal (non-business) use of this script is free for users of Ultra Hal Assistant.
'This is an entirely new function written by =vonsmith= , version 12-14-04a.
'
'This function searches a general knowledge and trivia file for information relevant to the user's request.
'
If (InStr(1, UserSentence, " WHAT CAN I TELL YOU ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT ELSE CAN I TELL YOU ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT ELSE DO I KNOW ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " WHAT DO I KNOW ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " TELL YOU SOMETHING ABOUT ", vbTextCompare) > 0 Or InStr(1, UserSentence, " TELL YOU SOMETHING ELSE ABOUT ", vbTextCompare) > 0) And GetResponseBlock <> True Then
InfoStart = 0
InfoStart = InStr(1, UserSentence, " ABOUT ", vbTextCompare) + Len(" ABOUT ")
InfoEnd = Len(UserSentence)
InfoRequest = Mid(UserSentence, InfoStart, (InfoEnd - InfoStart)) 'Extract requested info phrase.
InfoRequest = " " & HalBrain.AlphaNumericalOnly(InfoRequest) & " "
HalInfoBrain = HalBrain.QABrain(InfoRequest, WorkingDir & "XTF_SYS_GeneralInfo.brn", InfoBrainRel)
If InfoBrainRel > 15 And InfoBrainRel < 25 Then
GetResponse = " You might not think this is relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
ElseIf InfoBrainRel > 24 And InfoBrainRel < 45 Then
GetResponse = " I think this may be relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
ElseIf InfoBrainRel > 44 Then
GetResponse = " This seems very relevant. " & HalInfoBrain & VbCrLf
GetResponseBlock = True
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
Else
GetResponse = " Sorry, I can't think of anything relevant. " & VbCrLf
BlockPrevTopicSave = True
DebugInfo = DebugInfo & "The user was requesting Hal to recall general or trivial knowledge and Hal has done so: " & HalInfoBrain & VbCrLf
End If
BlockSave = True
End If
'x=x=x=x=x=x=x=x==vonsmith==x=x=x=x=x=x=x=x=x
'XTF Brain v1.4 Related End
'The "RESPOND: DICTIONARY FUNCTION" function should follow this.
'RESPOND: DICTIONARY FUNCTION
'If the user asks Hal to define a word, then access wordnet and define it
If WordToLookup = "" Then WordToLookup =
If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "PLEASE DEFINE *", 1)
If WordToLookup = "" Then WordToLookup = HalBrain.SearchPattern(UserSentence, "DEFINE *", 1)
If WordToLookup = "" Then WordToLookup =
HalBrain.SearchPattern(UserSentence, "* DEFINITION OF *", 2)
---------------------------------------------------------------------
I should get a respond about relevance when I have this installed right?