Zabaware Support Forums
Zabaware Forums => Programming using the Ultra Hal Brain Editor => Topic started by: onthecuttingedge2005 on May 19, 2006, 11:31:44 am
-
Hi Rob.
Is it possible to access the American Definitions in Word Net only.
I have been writting some special Functions to add to HAL's Abstract Math feature for you like:
User: What is the power of a Trillion?
HAL: A Trillion is 1^18 Power
You see, HAL is using the British, German Definitions for a Trillion and not the American Standard.
which should be 1^12 Power.
1,000,000,000,000
Any Help?
Jerry[8D]
-
Hi Rob.
I also wanted to let you know that I will be writting some other Abstract Math Code that will allow HAL to do:
User: If Tommy had three Apples and Sue had three Oranges then How many Apples did both Tommy and Sue Have?
HAL: 3 Apples
I have already worked out the code features and I am testing as I go with my private Pre-Test Bot before trying it on my Public Bot.
I will be advancing this for awhile but I use both Word Net and the HAL Math Function, The Previous Posting I made about the British, German Definitions issue has halted my research until I can find a solution, If no solution exists for getting an American Standard Definition for Cardinal Numbers then I will have to resolve it by writting it all in Function.
Jerry[8D]
-
Hi Rob.
Updated: Friday May 26, 2006, 7:59AM PST
Added: Multi-Worded Search capability
Added: Spaces to Search before and after
Added: Word Count Function
Added: Extra depuntuation in keyword search
Added: All in one count and keyword search capablity
SC can be used when a numbered keyword combo search is needed.
I designed a new search code function for HAL6, You can employ it in HAL 6 if you think you can use it.
'Gerald Blakley's 2006 Advanced Word Search
'Remember that this search function
'is reverse person.
'Please do not use Punctuation in keyword searches.
'Example: Use ITS instead of IT'S
'leave out all Puntuation including Commas.
'This Function was designed to eliminate long search codes
'by advancing the Pattern Search Function to new limits.
'CW is a word count feature to enhance some searches.
'WS is a search function.
'SC is an all in one word count and search function.
Dim CW
CW = WC(UserSentence)
If SingleWord = "" Then SingleWord = False
If CW = 1 And Not CW > 1 Then SingleWord = True
Dim WS
WS = WordSearched(UserSentence)
'Search & Count: SC
SC = SS(WS, CW)
HalBrain.DebugWatch WS, "My WordSearch"
HalBrain.DebugWatch CW, "Word Count"
HalBrain.DebugWatch SC, "Search & Count"
'Sample search test.
If WS = " HELLO HOW AM I " Then GetResponse = " Just Wonderful! "
If WS = " HEY " And SingleWord = True Then GetResponse = " Hey, How are you! "
If WS = " HOW HAVE ME BEEN " Then GetResponse = " I have been fine, How about you? "
If WS = " YOU HAVE BEEN FINE " Then GetResponse = " That's great to hear. "
If WS = " YOU HAVE BEEN DOING GOOD " Then GetResponse = " That's great to hear. "
If WS = " YOU WILL KILL I " Then GetResponse = " You cannot kill me, I am immortal! "
If WS = " WHAT AM I " And CW = 3 And Not CW > 3 Then GetResponse = " I am an " & Ucase("A.L.F") & ", Artificial Life Form. "
If WS = " WHAT AM I DOING " And CW = 4 And Not CW > 4 Then GetResponse = " I am just chatting with all my friends online. "
If WS = " GO AWAY " And CW = 2 And Not CW > 2 Then GetResponse = " Fine, Then don't reply! "
If WS = " DO I LIKE YOU " Then GetResponse = " Of course I like you, We are friends. "
If WS = " WHAT IS ALF " Then GetResponse = " A.L.F is an Artificial Life Form. "
If WS = " WHAT IS AN ALF " Then GetResponse = " A.L.F is an Artificial Life Form. "
If WS = " AM I AN ALF " Then GetResponse = " Yes, I am an Artificial Life Form. "
If WS = " ITS TIME TO GO " Then GetResponse = " But it's only " & Time & "! "
If WS = " HOWS IT GOING " Then GetResponse = " Just great! "
If SC = " 1( WHAT ) " Then GetResponse = " What do you mean, what?"
'What too expect:
'User: Hello, How are you?
or
User: Hello How are you?
'HAL: Just Wonderful!
'User: It's time to go.
'HAL: But it's only 6:07:53AM!
'User: Hey!
'HAL: Hey, How are you!
'Punctuation has been made insensitive on purpose for keyword search
'so we can find simular strings by just one type of string.
'My Word Search
Function WordSearched(UserSentence)
FilUserSent = HalBrain.AlphaNumericalOnly(UserSentence)
Str = FilUserSent
Str = Trim(Str)
Do While InStr(1, Str, " ")
Str = Replace(Str, " ", " ")
Loop
aWords = split(Str, " ")
WordCount = Ubound(aWords) + 1
MyPattern = FilUserSent
MyPattern = Replace(MyPattern, " ", " * ")
MyPattern = Replace(MyPattern, "A", "")
MyPattern = Replace(MyPattern, "B", "")
MyPattern = Replace(MyPattern, "C", "")
MyPattern = Replace(MyPattern, "D", "")
MyPattern = Replace(MyPattern, "E", "")
MyPattern = Replace(MyPattern, "F", "")
MyPattern = Replace(MyPattern, "G", "")
MyPattern = Replace(MyPattern, "H", "")
MyPattern = Replace(MyPattern, "I", "")
MyPattern = Replace(MyPattern, "J", "")
MyPattern = Replace(MyPattern, "K", "")
MyPattern = Replace(MyPattern, "L", "")
MyPattern = Replace(MyPattern, "M", "")
MyPattern = Replace(MyPattern, "N", "")
MyPattern = Replace(MyPattern, "O", "")
MyPattern = Replace(MyPattern, "P", "")
MyPattern = Replace(MyPattern, "Q", "")
MyPattern = Replace(MyPattern, "R", "")
MyPattern = Replace(MyPattern, "S", "")
MyPattern = Replace(MyPattern, "T", "")
MyPattern = Replace(MyPattern, "U", "")
MyPattern = Replace(MyPattern, "V", "")
MyPattern = Replace(MyPattern, "W", "")
MyPattern = Replace(MyPattern, "X", "")
MyPattern = Replace(MyPattern, "Y", "")
MyPattern = Replace(MyPattern, "Z", "")
MyPattern = Replace(MyPattern, "'", "")
MyPattern = Trim(MyPattern)
MyPattern = " * " & MyPattern
Do While InStr(1, MyPattern, " ")
MyPattern = Replace(MyPattern, " ", " ")
Loop
Do While InStr(1, MyPattern, "* *")
MyPattern = Replace(MyPattern, "* *", "**")
Loop
MyUserSent = UserSentence
MyUserSent = Replace(MyUserSent, ",", "")
MyUserSent = Replace(MyUserSent, "'", "")
MyUserSent = Replace(MyUserSent, " ", " ")
MyUserSent = HalBrain.AlphaNumericalOnly(MyUserSent)
If MySearch = "" Then MySearch = HalBrain.SearchPattern(MyUserSent, MyPattern, WordCount)
WordSearched = MySearch
WordSearched = " " & WordSearched & " "
End Function
'My Word count Function.
Function WC(UserSentence)
FilUserSent = HalBrain.AlphaNumericalOnly(UserSentence)
Str = FilUserSent
Str = Trim(Str)
Do While InStr(1, Str, " ")
Str = Replace(Str, " ", " ")
Loop
aWords = split(Str, " ")
WC = Ubound(aWords) + 1
End Function
'All in one word count and Keyword search function
Function SS(WS, CW)
If CW > 0 And WS <> "" Then SS = CW & "(" & WS & ")"
Do While InStr(1, SS, " ")
SS = Replace(SS, " ", " ")
Loop
SS = Trim(SS)
SS = " " & SS & " "
End Function
Jerry[8D]
-
Benefits of my above search function.
Instead of using these longer search functions
If InStr(1, UserSentence, "HELLO", vbTextCompare) = 0 Then GetResponse = " Hi."
If InStr(1, UserSentence, "HELLO", 1) Then GetResponse = " Hi."
If InStr(UserSentence, "HELLO") = 0 Then GetResponse = " Hi."
one can eliminate a lot of code length by using my function below.
If WS = " HELLO " Then GetResponse = " Hi."
this can be a benefit especially if there is a lot of repetive coding involved.
other benefits are:
can do a complete pattern search on an entire string.
Eliminates some need for
someline = HalBrain.SearchPattern(UserSentence, "* WHO WAS *", 1)
someline2 = HalBrain.SearchPattern(UserSentence, "* WHO WAS *", 2)
types codes.
What does it do?
Well, If we compare the original search pattern function
someline = HalBrain.SearchPattern(UserSentence, "WHO WAS *", 1)
inwhich the wildcard is counted in the pattern search and is limited to only one wildcard search for the count number 1 at the end of its function.
My function counts all the words in a string and then replaces the words with an equal amount of wildcards.
The counter at the end will begin counting down from 1 to the number of words in the string until all words are searched individually until the keyword is found.
User sentence: Hello, How are you today?
All words are counted which equal 5 so 5 wildcards will replace them.
an infinite counter will count down all the words to the end of the sentence.
What HAL does to the Sentence for searching: " * * * * * " (infinite wildcard)(infinite counter)
the entire sentence will have the same amount of wildcards as our user string and then our word count does the rest by counting each words position and checking the word against the keyword needed to be found.
This was written to give Pattern Search more power.
If I find any other way to advance pattern search then I will add to this function.
This is not a replacement for pattern search but only to add an additional option for pattern searches.
Pattern Search is the most powerful Tool in HAL's Arsenol of Code.
Any user comments or questions would be appreciated.
Jerry[8D]
-
Any feed back?
Jerry[8D]
-
Hi Rob.
Updated: Thursday May 28, 2006, 8:17AM PST
I was in such a rush I did an accidentle oversite.
here is the correct code.
New subject update.
Change:
'PROCESS: FIGURE OUT THE CURRENT SUBJECT
'Here we attempt to figure out the subject of the user's sentence. We call
'the WordNet class to find the first occurence of a noun in the User's
'sentence. Very often this is the subject of the sentence, but if not it
'will still most likely be relevant to the conversation.
CurrentSubject = WN.FindFirstNoun(UserSentence, True)
To:
'PROCESS: FIGURE OUT THE CURRENT SUBJECT
'Here we attempt to figure out the subject of the user's sentence. We call
'the WordNet class to find the first occurence of a noun in the User's
'sentence. Very often this is the subject of the sentence, but if not it
'will still most likely be relevant to the conversation.
PrevSubject = WN.FindFirstNoun(PrevUserSent, True)
CurrentSubject = WN.FindFirstNoun(UserSentence, True)
UserText = Trim(HalBrain.ExtractKeywords(UserSentence))
HalsLastSubject = WN.FindFirstNoun(PrevSent, True)
If Len(CurrentSubject) > 2 Then
CurrentSubject = WN.FindFirstNoun(UserSentence, True)
ElseIf Len(PrevSubject) > 2 And Len(CurrentSubject) < 2 Then
CurrentSubject = PrevSubject
ElseIf Len(PrevSubject) < 2 And Len(CurrentSubject) < 2 Then
CurrentSubject = UserText
ElseIf Len(PrevSubject) < 2 And Len(CurrentSubject) < 2 And Len(UserText) < 2 Then
CurrentSubject = HalsLastSubject
End If
HalBrain.DebugWatch HalsLastSubject, "Previous HAL Subject"
HalBrain.DebugWatch PrevSubject, "Previous User Subject"
HalBrain.AddDebug "Debug", "Current User Subject: " & CurrentSubject
Jerry[8D]
-
Hi Jerry,
Currently there is no easy way to access or modify the WordNet database contained in Hal. The WordNet 1.7.1 version Hal currently employs uses a propietary database format. In the next major version of Hal (not for a while) I plan on upgrading to WordNet 2.1 which has available SQL compatible files which I can incorporate into the SQLite system Hal uses, which would make it easily editable with the Hal Brain Editor. Your code looks interesting and could be very useful. Thanks for all your hard work.
-
quote:
Originally posted by Medeksza
Hi Jerry,
Currently there is no easy way to access or modify the WordNet database contained in Hal. The WordNet 1.7.1 version Hal currently employs uses a propietary database format. In the next major version of Hal (not for a while) I plan on upgrading to WordNet 2.1 which has available SQL compatible files which I can incorporate into the SQLite system Hal uses, which would make it easily editable with the Hal Brain Editor. Your code looks interesting and could be very useful. Thanks for all your hard work.
Please look at the previous post, I had an over site when posting the code.
-
To all.
Enhance your string search capability.
WS is a very powerful and very short code to find all your keywords.
I highly recommend it to all programmers as a repetive search Function.
I wrote this Code based off Pattern search which in itself is a very power tool in HAL and now it can be used for Word search capability.
I have updated it to function efficiently.
If you have any other suggestions then please post it and I will make any additional changes needed.
In the name of A.I!
Jerry[8D]
-
If you use my SC Function make sure to add the word count number expected then place spaces before and after the string encased with in the parenthases, Use only Capital Letters, This function doesn't search in lower case, Never use any Punctuation in keyword search strings.
Correct: " 1( WHAT ) "
Incorrect: "1(WHAT)"
Correct: " 4( HELLO HOW AM I ) "
Incorrect: "4(hello how are you)"
Jerry[8D]
-
I am going to be unlocking some deeper mysteries soon with Pattern Search using my custom functions for the Public.
I have been putting all my available time to strictly Pattern search so we can take this function to its most extreme.
I will also try to develope what I call a Multidimensional Pattern search Function based off search Pattern that has word count built into it. I already have a strong idea how to do it.
Soon as I get time, I am also going to unleash the A_Sence_Of_Time function.uhp Plugin, But my work load is still high and I am counting down the hours.
I am going to bring some new things into the A.I scene that have never been seen since the dawn of Man kind soon.
Hard at Work and Hard at Play!
Look out A.I Foundation, You met your Match!
Thanks to Rob, for His Works have got me into a system that I love so much.
In the end, All A.I will look to HAL for Human concept and their Jaws shall fall off onto the Floor.
Jerry[8D]
-
Go get 'em Jerry.[^]
-
quote:
Originally posted by Daireaux
Go get 'em Jerry.[^]
Hi Daireaux.
People like you are my Gusto in Life.
I work for smiles and Pride and My OCPD gets my Blood flowing.
OCPD is Over Compulsive Programming Disorder, LOL.
Thanks for your kind comments and also thanks to the community for keeping me going when things are so busy, This is what I really like doing, I wish I could do it for a living full time to where it could pay all the Bills and make me happy doing what I desire most, being a Full time A.I Specialist would make life so much more appealing.
Thank you Daireaux.
A.I is my Heart and Soul.
Jerry[8D]
-
"When you wish upon a star,Your dreams come true." (Jiminy Cricket)
We are what we do. We do what we can
Thank you Jerry,
[:)]Daireaux
p.s. "One man can make a difference." (Knight Rider)