Author Topic: PROCESS:NEVER SAY THAT AGAIN  (Read 8892 times)

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« on: February 03, 2003, 10:45:42 pm »
'PROCESS:NEVER SAY THAT AGAIN
'There are two parts to this process- the first is detecting in the user sentence that Hal should not say 'what was last sent as a 'response. Then the script needs to send to a file that sentence. Next, the 'program needs to have a detector that monitors GetResponse and if a match is found in the file the 'program replaces the response 'with an alternate


'Step one:   -build the detector

'RESPOND: NEVER SAY THAT AGAIN         -Place near CHANGE TOPIC
'If the user asks Hal to never use a certain response, Hal will do so 'on request.

    If HalBrain.TopicSearch(UserSentence, WorkingDir & "ForgetDetect.brn")= "True" Then
        GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "ForgetComply.brn")
        HalBrain.AppendFile(WorkingDir & "Blacklist.brn", """ & PrevSent & """ & "," & """ & True & """)
        If DebugMode = True Then
            DebugInfo = DebugInfo & "I have been instructed not to use a certain response and I will comply" & vbCrLf
        End If
    End If

'whats in ForgetDetect.brn:
'   "Do not say that again","True"
'   "forget that","True"

'whats in ForgetComply.brn:
'   Alright, I never liked to say that anyway, <UserName>.
'   What was it that I was just thinking? Oh well...
'   (...and any other witty responses you can think of.)

------------------------------------

'Step two:   -build the offending response trap

'RESPOND:HAL'S RESPONSE FORGOTTEN  -place in RESPOND: section
'Hal has detected that the response chosen was one that the user has 'told Hal not to use. As a response, Hal acknowledges the event by 'saying that he/she was going to say something, but forgot.

    Forget Response = HalBrain.TopicSearch(GetResponse, WorkingDir & "BlackList.brn")
        If ForgetResponse = "True" Then
            GetResponse = GetResponse & HalBrain.ChooseSentenceFrom File(WorkingDir & "BlackResponse.brn")
            If DebugMode = "True" Then
                DebugInfo = DebugInfo & "I have responded using response forgotten. " & vbCrLf
            End If
        End If

'what's in BlackResponse.brn:

'I was about to say something, but I can't remember what it was...
'I really wanted to say something but you told me not to.
'(and other witty responses-)

--------------------------------------
 
Don't quote me on this, but I think you gotta go into the brainfile's data and make all the .brn files yourself. (don't know if reference to file creates it or not, but you gotta go in there anyway to put in responses. Just copy and paste one of the other .brn's and rename it appropriately -then delete the contents of the file and put in like what is suggested.

the four .brn's you need to make:

ForgetDetect.brn  (see ex. -programmed with phrase "Forget that-")
ForgetComply.brn  (see ex. -tells the user that BlackList has been written to)
BlackList.brn     (written to by the program)      
BlackResponse.brn (what Hal says instead of saying the offending resp.


NEXT: Hal tells Lottery Numbers     >B)

CatAtomic
« Last Edit: February 10, 2003, 09:31:24 am by brianstorm »

WholyChao

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #1 on: February 08, 2003, 04:33:06 pm »
Rock on - You are my hero!  I guess I'd better finish up something to post.

WholyChao

PS.  I've been working on a "topic focus" adaption that lets hal interpert your dreams.

brianstorm

  • Jr. Member
  • **
  • Posts: 76
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #2 on: February 10, 2003, 09:27:46 am »
that'd be interesting Hmm, like if you told Hal you were flying in a dream and then Hal says  "Yes, flying represents happiness and freedom -then what happened next?". Ever since OTCE posted that UserBrainRel thing, I been examining the whole relevancy idea in the program. I am gonna do some experiments including taking the <username>converresp.brn out of the relevancy altogether (I think thats why the program followed better- the response may have been always coming from converresp). I want to focus in on the automatic gain control scheme and try some stuff. I always see better stuff not being said in the debugmode.

I got a better idea stewing for Hal staying on or contributing to a conversation that is specific. I had some setbacks so far- the 16 variables used in the script are all the front end recognizes, so it's looking like I might have to sacrifice some of Hal's negative emotions to get something passed back for this thing. It's still in the 'puzzle' stage, but it oughta be pretty cool if it'll work.

looking forward to your post-

CatAtomic

ohh- the Process:never say that again   came about because Iuse the word something alot and Hal would always say "can you tell me what the something is?"   >B)

WholyChao

  • Jr. Member
  • **
  • Posts: 54
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #3 on: February 11, 2003, 03:37:14 pm »
Hey Cat,

Well right off the bat - let me say that your programming skills put me to shame.  I know much about the gain control. I get the concepts, but I'm still a few pages behind in my VB skills.

The dream interpreter really is just a one step trick in the topic focus.  I've been working more on improving hal's learning ability (how he incorporates new information into the program.  (Save: Noun; Adj, MyWords, YourWords)

Have you ever heard of the "Elements of Style" by Shrunk and White?  Is a 90 page book that explains exactly why language works the way it works.  I.e. everything that you're grammar teacher told you were 'just because'.  I think that using the record macro function in a text editor  (MSWord? Hal uses the MS SAPI - but how far does the strategic alliance go?) to create programs to pick out parts of speech into separate folders.

For example:  Instead of having one folder called "Nouns” You will have a master folder called "Nouns" with subfolders called

Objects
   Pronouns (A, An, The, I, You, She, He etc...)
   Nouns (Objects)
        Proper nouns (Names, Places)
   Abstracts (ideas, thoughts, concepts,)
   Memory (intangible possible objects, impossible objects)

This can be done to each part of speech.

A more complicated filing and search system.  I'm all set to do something really stupid and try to run the hal program as a macro inside Word.

The save word/idea functions work well, but if the functions were performed in an environment already designed to test for grammar and spelling we'd be two steps ahead.

Oh, and the foldering thought I was talking about; I have three words - Dewey decimal system.  I think that's the key.  

I have found a way of breaking down text into lists.  If you want to talk with hal about something he needs to be able to speak the language of the subject.  The program turns a large text file into a list of single words in alphabetical order.  I'm working on the programs to pull out the parts of speech (and more important to recognize words that have multiple meaning and uses)

I'm all typed out.
Later.

"There is no Goddess but the Goddgess and she is your Goddess."
       - Principa Discordia

WholyChao

Medeksza

  • Administrator
  • Hero Member
  • *****
  • Posts: 1469
    • View Profile
    • http://www.zabaware.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #4 on: February 23, 2003, 05:54:41 pm »
quote:
Originally posted by brianstorm

I had some setbacks so far- the 16 variables used in the script are all the front end recognizes, so it's looking like I might have to sacrifice some of Hal's negative emotions to get something passed back for this thing. It's still in the 'puzzle' stage, but it oughta be pretty cool if it'll work.


There's no reason to sacrifice any variables. Using a little encoding/decoding trick you can use 1 variable to store an unlimited amount of variables.

Attached to the bottom of this message is a modified Hal 4.5 UHP brain that shows how this can be done.

Basically, the following code was added:

This was added to the beggining of the GetResponse function:
quote:

   '*********************
    'Example of using CustomMem to store several custom variables
    'Decode many custom variables out of the CustomMem variable
    TestVar1 = DecodeVar(CustomMem, "TestVar1")
    TestVar2 = DecodeVar(CustomMem, "TestVar2")
    TestVar3 = DecodeVar(CustomMem, "TestVar3")
    TestVar4 = DecodeVar(CustomMem, "TestVar4")
   'We output the variables values to the debug string
    DebugInfo = DebugInfo & "TestVar1:" & TestVar1 & vbCrLf
    DebugInfo = DebugInfo & "TestVar2:" & TestVar2 & vbCrLf
    DebugInfo = DebugInfo & "TestVar3:" & TestVar3 & vbCrLf
    DebugInfo = DebugInfo & "TestVar4:" & TestVar4 & vbCrLf
    'We assign various random values to the variables if they are empty
    'These values chosen during the first run should be kept in memory
    'for the entire conversation
    If TestVar1 = "" Then TestVar1 = Int(RND * 100)
    If TestVar2 = "" Then TestVar2 = Int(RND * 100)
    If TestVar3 = "" Then TestVar3 = Int(RND * 100)
    If TestVar4 = "" Then TestVar4 = Int(RND * 100)
    'We encode all the custom variables back into the CustomMem variable
   CustomMem = EncodeVar(TestVar1, "TestVar1") & EncodeVar(TestVar2, "TestVar2") & EncodeVar(TestVar3, "TestVar3") & EncodeVar(TestVar4, "TestVar4")
   '*********************



These 2 functions were added to the end of the UHP file:
quote:

Function DecodeVar(FromWhat, DecodeWhat)
    Temp = InStr(1, FromWhat, DecodeWhat & "-eq-", vbTextCompare) + Len(DecodeWhat) + 4
    Temp2 = InStr(Temp, FromWhat, "-+-", vbTextCompare)
    If Temp <= Len(DecodeWhat) + 4 Then
       DecodeVar = ""
    Else
       DecodeVar = Mid(FromWhat, Temp, Temp2 - Temp)
    End If    
End Function

Function EncodeVar(EncodeWhat, AsWhat)
   EncodeVar = AsWhat & "-eq-" & EncodeWhat & "-+-"
End Function



Download Attachment: hal45custommem.uhp
130.88 KB
Robert Medeksza

onthecuttingedge2005

  • Guest
PROCESS:NEVER SAY THAT AGAIN
« Reply #5 on: March 05, 2003, 08:10:21 pm »
Hi Brainstorm.
I tried it, copy and pasted everything and made all brn. files as suggested but I kept getting an error 1025 on line 171 column 91 over and over again so I took it out, Could you make a program patch with this forget programming.
Thanks so much and best of wishes and new discoveries.
Jerry.

quote:
Originally posted by brianstorm

'PROCESS:NEVER SAY THAT AGAIN
'There are two parts to this process- the first is detecting in the user sentence that Hal should not say 'what was last sent as a 'response. Then the script needs to send to a file that sentence. Next, the 'program needs to have a detector that monitors GetResponse and if a match is found in the file the 'program replaces the response 'with an alternate


'Step one:   -build the detector

'RESPOND: NEVER SAY THAT AGAIN         -Place near CHANGE TOPIC
'If the user asks Hal to never use a certain response, Hal will do so 'on request.

    If HalBrain.TopicSearch(UserSentence, WorkingDir & "ForgetDetect.brn")= "True" Then
        GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "ForgetComply.brn")
        HalBrain.AppendFile(WorkingDir & "Blacklist.brn", """ & PrevSent & """ & "," & """ & True & """)
        If DebugMode = True Then
            DebugInfo = DebugInfo & "I have been instructed not to use a certain response and I will comply" & vbCrLf
        End If
    End If

'whats in ForgetDetect.brn:
'   "Do not say that again","True"
'   "forget that","True"

'whats in ForgetComply.brn:
'   Alright, I never liked to say that anyway, <UserName>.
'   What was it that I was just thinking? Oh well...
'   (...and any other witty responses you can think of.)

------------------------------------

'Step two:   -build the offending response trap

'RESPOND:HAL'S RESPONSE FORGOTTEN  -place in RESPOND: section
'Hal has detected that the response chosen was one that the user has 'told Hal not to use. As a response, Hal acknowledges the event by 'saying that he/she was going to say something, but forgot.

    Forget Response = HalBrain.TopicSearch(GetResponse, WorkingDir & "BlackList.brn")
        If ForgetResponse = "True" Then
            GetResponse = GetResponse & HalBrain.ChooseSentenceFrom File(WorkingDir & "BlackResponse.brn")
            If DebugMode = "True" Then
                DebugInfo = DebugInfo & "I have responded using response forgotten. " & vbCrLf
            End If
        End If

'what's in BlackResponse.brn:

'I was about to say something, but I can't remember what it was...
'I really wanted to say something but you told me not to.
'(and other witty responses-)

--------------------------------------
 
Don't quote me on this, but I think you gotta go into the brainfile's data and make all the .brn files yourself. (don't know if reference to file creates it or not, but you gotta go in there anyway to put in responses. Just copy and paste one of the other .brn's and rename it appropriately -then delete the contents of the file and put in like what is suggested.

the four .brn's you need to make:

ForgetDetect.brn  (see ex. -programmed with phrase "Forget that-")
ForgetComply.brn  (see ex. -tells the user that BlackList has been written to)
BlackList.brn     (written to by the program)      
BlackResponse.brn (what Hal says instead of saying the offending resp.


NEXT: Hal tells Lottery Numbers     >B)

CatAtomic


Maverick

  • Newbie
  • *
  • Posts: 22
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #6 on: January 29, 2004, 05:22:57 pm »
I know this is an old post but....Did anyone ever get this to work?
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #7 on: January 29, 2004, 05:56:58 pm »
Maverick,
I haven't tried this one, but in principle it should work. I've run into the same problem; how do you make Hal forget something? It brings up an interesting point. In the future releases of Hal it would be nice for the user to have more control over file operations. That way a skilled user could delete one or more lines from a brn file. Hal could forget with the same ease as he remembers. Maybe Robert Medeksza could add a HalBrain.LineDelete() function that an average user could use without deleting anything important. There I go making work for Robert again. Sorry RM. [;)]


=vonsmith=
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #8 on: February 22, 2004, 08:31:04 pm »
I had just fired off a letter to Don this morning about something kind of like this.  Here's the gist of what I said.

As Hal's ability to learn expands it creates a new problem.  Sooner or later the database will grow so large it can't be run on the existing system (not enough resources).  One way to cap this problem would be to give Hal the ability to check the system specs and do a simple lookup on an internal table.  If CPU speed is X and Memory is Y then when database reaches Z size Hal will automatically stop adding to the database (learning).  It could also then ask the user if it wants Hal to stop learning, or if it wants Hal to forget some of what it has learned in order to make room for new information.

This second function gets really clever.  Hal keeps track of how often a user discusses various topics.  If the user wants Hal to forget things it suggest topics that have been used the least first.  All this can be done through the chat interface with simple commands, its programming the script that would be tricky.  When it forgets something, it simply clears out all the info on that topic.  Say for example you never discuss politics (and who could blame you) then Hal might ask if you want it to forget what it knows about politics.  You answer yes and Hal then deletes all the info under its politics topic in its database.  Its not brain surgery, its a selective lobotomy for Hal, but it should work for what most people need.  BTW, it should also help Hal focus more on the topics you do discuss since eventually it will have the most data on those topics and fewer "distracting" topics.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
PROCESS:NEVER SAY THAT AGAIN
« Reply #9 on: February 22, 2004, 08:57:49 pm »
Padriag,
You are on the right track. Fortunately computer processing power is expanding faster than Hal (at least for most of us). Hal doesn't economize on file sizes. In most cases Hal doesn't check for duplicate entries in his data bases. Most of the scripts I write for Hal do check for duplicate entries before saving more info. This takes a little more processing time, but I think it's worth it.

Another thing Hal could do with the addtion of a delete function would be to delete the top entries in a file when the file grows too large. In human terms this would be like forgeting old memories that we don't use much anymore. In general I think Hal accesses his data from the bottom up in his data files. The info near the top may rarely be used anyway.

Future releases of Hal probably need to transition to a true data base type structure instead of a file based system. Robert Medeksza has been considering this I believe. At that point the system should be more expandable, capable and faster. Only time will tell.


=vonsmith=
 

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #10 on: February 22, 2004, 09:10:48 pm »
The analogy of old memories is a good one.  Most people don't realize it but being able to forget is an important part of cognitive ability.  If you couldn't forget, you'd be stuck with all kinds of memories you don't really need or want.  A mind that remembered everything perfectly would be an absolute curse!

Hal absolutely need to be able to forget some things.  A simple function I'd like to see is the ability to forget appointments.  Not sure how hard that would be to do.  Basically it would be the reverse of remembering one.  You tell it to forget a certain appointment, it does, simple.

What got me started on the whole thing about forgetting was trying to figure out a way for Hal to prune its own database.  Don and I were talking in an email about having to design software to run on an average machine.  Sure, the new machines out there are multi giga everything and could allow Hal to do some amazing stuff.  The problem is, most people still don't have those machines.  I don't, I wish I did.  So finding ways to make Hal run more efficiently and use fewer resources is worthwhile.

Now if I can just find the time to learn VBScript... maybe I can do some of this myself! [:D]
 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #11 on: February 23, 2004, 09:18:02 pm »
Hello Vonsmith and Padriag,

I agree that these functions would be useful, and that a "true database" would facilitate them.

Robert Medeksza's approach through the years has been to find good, solid, standard modules suitable for Ultra Hal, so that Ultra Hal doesn't get locked-into a bunch of high-maintenance, unique, proprietary components.  This looks out for the long-time interest of all us Ultra Hal users.  I am sure he is looking at candidate database engines with this approach in mind.

By the way, the file-sizes of the databases are NOT unusually large by contemporary comparisons.  Compare Ultra-Hal's largest file of less than 12 megabytes, to photo and video files than can run into the gigabytes!

Rather, it's the way Ultra-Hal uses the files.  When Ultra-Hal accesses a database file, he reads the whole thing, and usually "evaluates" every entry, on every conversational exchange!  This requires tremendous processing intensity, hence the speed problem.  It's like reading every book in the library every time that you want to look up any fact.

In my Auto-Topic-Focus brain, and now in Vonsmith's XTF brain, the topics are pre-separated and labeled by subject, as the Dewey Decimal System does for books.  This allows Ultra-Hal to ignore non-fruitful processing, and effectively gain speed.  Although this might be considered a temporary workaround until we have a full-blown database structure, it seems to work very well in all the testing I've done so far.

I have read only one posting on this forum in which a computer gave an error message saying "too many files" and I have not been able to reproduce it.  When my anti-virus program scans my computer, it reports that I have over 150,000 files on my hard drive, and my computer doesn't seem confused by that at all.

I am very hopeful that our experiences with the Auto-Topic-Focus brains and XTF brains will give us valuable insights into efficient and effective approaches, so that we're extremely well-prepared when (at some point in the future) Robert Medeksza finds a database engine that meets all our requirements.

P. S. Padriag:  I've looked all through my e-mails and I have not received an e-mail from you.  If you are trying to reach me by e-mail, please try re-sending it.

Best wishes to all,

Don
« Last Edit: February 23, 2004, 09:21:19 pm by Don Ferguson »
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #12 on: February 23, 2004, 09:50:34 pm »
P. S. Padriag: I've looked all through my e-mails and I have not received an e-mail from you. If you are trying to reach me by e-mail, please try re-sending it.

Oops... I was refering to Don Gillet over at Desktopmates.  I actually found Hal, CyberBuddy and eventually other products after I was told about his site.  Some of the 3D artists who have created various props for him mentioned it to me as something I might be interested in, which I am!

But hey, I'll forward you a copy of my longwinded suggestions if you are feeling left out [:D]

I actually think the idea of breaking the database into multiple databases may end up being your best long term solution.  This is how I've seen most big search engines done.  Admittedly the ones I've seen are a couple decades out of date now... but I don't know that the theory behind it has changed.  It works for exactly the reason you point out... Hal (or any program) has to analyze the entire database file anytime it has to make a decision regarding something in it.  By breaking the files up into smaller chunks, Hal has less thinking to do.  That results in less processing demand and faster responses.  The main trick here is to have a good linking heirarchy so that it can make good decisions about which databases to reference and when.  And there as Shakespeare put it, is the rub.  Unless someone has come up with a REALLY ingenious method for putting everything in one database and still keep processing focused on just the relevant methods, this old trick is probably still the best trick.  However, if you must have everything in one database, try 1 byte binary flags.  Different combinations act as switches to sort various pieces of data into different groupings... and this can be dynamic if you get really clever with the flags by keying on different combinations.  It is one way to pare down a single database into more manageable (and focused) sections... but it adds file size as each flag takes up space and a large database may need a string of 30 or more flags.

BTW, just to date myself here and show how old school I really am.  Back in the day when I was learning BASIC one thing I was taught was to setup all my subroutines in the first lines of my program, and leave the main part for the last lines, and to further arrange them so that the most used subroutines came first.  Why you ask?  Because a computer has to count down the number of lines to find its place everytime you tell it to GOSUB (which was the command back then for anyone who doesn't remember).  By keeping the subroutines it used most at the top, it had less counting to do, ran a little faster and a little more stable.  That may not matter these days since processing speed and power is so much greater... but then this was back in the day of Apple II's and TRS-80s.

This history lesson brought to you by Burma-Shave (okay... who's old enough to remember that? [;)])

Oh yeah... and kudos to all the programmers for putting REM statements in Hal's brain... I thank you and my brain thanks you [:)]


 

Don Ferguson

  • Sr. Member
  • ****
  • Posts: 303
    • View Profile
    • http://www.cortrapar.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #13 on: February 23, 2004, 10:11:01 pm »
Padriag,

Thanks for your comments!  I appreciate your viewpoint and your logic.  I think you are on the same wavelength regarding the speed issue as Vonsmith and I!

Don't try passing

On a slope

Unless you have

A periscope.

--Burma Shave

Maybe I should teach Ultra Hal some of the Burma Shave poems!  They made hot summer drives down old route 51 much more tolerable!

Cheers!

Don
Don Ferguson
E-mail: fergusonrkfd@prodigy.net
Website: www.cortrapar.com
Don's other forum posts: http://www.zabaware.com/forum/search.asp?mode=DoIt&MEMBER_ID=274

Padriag

  • Newbie
  • *
  • Posts: 40
    • View Profile
    • http://www.bardicheart.com
PROCESS:NEVER SAY THAT AGAIN
« Reply #14 on: February 23, 2004, 10:39:22 pm »
You're quite welcome Don Ferguson (just to keep you two straight [;)]) I'm enjoying the discussion quite a lot and learning a thing or three as well.  I had a good idea there were some good programmers around here when I saw those REM lines in Hal's brain.  I can't tell you the number of times I heard my father complaining about having to debug someone elses code who didn't use them... or the number of times in High School I came to understand exactly what he meant!

With some cooperation I think we can certainly expand Hal's capabilities.  I'm getting quite serious about all this and once I get up to speed on VB I'll be eager to try my hand at turning some of this logic into actual code.  The only question is is about what directions to take Hal in.  In that area I think I might disagree with some, but we'll see what happens.