dupa

Author Topic: HalCommands under Ultra Hal Assistant 5.0  (Read 49340 times)

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #30 on: December 08, 2004, 09:32:36 am »
Thanks Vonsmith! I'll give that a try when I get home. Have you ever considered using HAL for home automation? If you're interested I can help you with a basic setup that won't cost you too much. I'll tell you where to buy the hardware and what to buy for the tasks you wish to perform. I feel guilty that I'm asking you all these questions and there's no way I can help you.  Thanks to HALImprover also.
Talk to you laterm, guys. I'll let you know how it goes.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #31 on: December 08, 2004, 01:30:02 pm »
Quixote,
Thanks for the offer. I haven't considered home automation seriously yet. It's a project I have on the back burner until I get other things done first.

I offer support here because I'm interested in creating a more capable chatbot, I like the Ultra Hal product and I want to share what I learned from experience. I learn a lot from everyone else here too. Earlier this year I couldn't participate for a long time due to work. I hope that work doesn't interfere too much again in the future.


=vonsmith=
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #32 on: December 08, 2004, 04:35:53 pm »
Well, don't be shy. I owe you. [:D]
It works perfectly now! This is so cool I feel giddy. I can't wait to train my voice recognition a bit better. (I'm hesitant to use it yet because I don't want it to make mistakes and then HAL [AKA Project: SynthIA] will learn nonsense.

I another question. I see you rolling your eyes lol [:I] . Is there a way to vary the response? I suppose I can just insert something like this instead of GetResponse = " I'm turning on the TV boss. " ?

Roulette = Int(Rnd*3)+1
If Roulette = 1 Then GetResponse = "Right away. "
If Roulette = 2 Then GetResponse = "You got it. "
If Roulette = 3 Then GetResponse = "No problem. "
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #33 on: December 08, 2004, 05:27:28 pm »
Quixote,
There are lots of ways to do this.

Select Case (Int(Rnd * 5) + 1)
Case 1
GetResponse = " Okay, will do <UserName>. "
Case 2
GetResponse = " Consider it done. "
Case 3
GetResponse = " Okay, it's good as done. "
Case 4
GetResponse = " For you <UserName>, anything. "
Case 5
GetResponse = " Doing it now! "
End Select
GetResponseBlock = True


Or if you want a big bunch of random responses then...

GetResponse = HalBrain.ChooseSentenceFromFile(WorkingDir & "HalCmdResponses.brn")
GetResponseBlock = True

I attached a sample "HalCmdResponses.brn" file. It is important to always include two blank lines at the end of the file or Hal will never pick the last choice. Open the file and note the two blank lines at the end.


=vonsmith=


Download Attachment: HalCmdResponses.brn
600 Bytes
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #34 on: December 08, 2004, 05:46:01 pm »
Right on!  Thanks for the quick reply! I'll try it out later tonight. I'm just trying to get my lights set up with HAL now. It's not difficult, just tedious because I need both programs to work cooperatively. Thanks again.
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #35 on: December 09, 2004, 01:43:31 pm »
So far everything is working perfectly. I still need to train the voice recognition more though.

I was wondering how I can have it so that when I give HAL a command it responds  and then responds with another question, to which I can give an answer and have it execute a command.

For example:

ME: I'm Home, Synthia.
Synthia: Welcome home, <Username>. The time is <Time>. Would               you like to watch some television?
ME: sure.
'TV TURNS ON
Synthia: What channel would you like to watch?
ME: 22, please.
'TV CHANGES CHANNEL
ME: Thank you.
Synthia: Any time.

Is this possible?
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #36 on: December 10, 2004, 02:03:38 am »
Quixote,
Connecting a previous user input to a current user input is possible with Hal if certain modifications are made. The default Hal isn't set up for this. The XTF Brain does connect certain some inputs from one input to the next. The XTF Brain does this for memorizing user nicknames and learning to capitalize words for instance.

The best you can do for now is this:

ME: I'm Home, Synthia.
Synthia: Welcome home, <Username>. The time is <Time>. Would you like to watch some television?
ME: Turn on the television.
'TV TURNS ON
Synthia: What channel would you like to watch?
ME: Turn to television channel 22, please.
'TV CHANGES CHANNEL
ME: Thank you.
Synthia: Any time.


To do the above you need to create a detection string like the commands as we previous discussed. The detection strings for turn-on and channel change would be independent from each other. They would have to be sufficiently unique in content and length as not to be confused with other commands. The detection string for changing to channel 22 requires a more complex detection scheme. First you have to detect "Turn to television channel", then you have to use a detection method to extract the "22" from the string. If you have just a few channels you could use full strings for detection, i.e., "Turn to television channel 22", "Turn to television channel 23", "Turn to television channel 24", etc. If you have hundreds of channels this methods isn't efficient, but it would still work.


=vonsmith=
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #37 on: December 13, 2004, 11:22:17 pm »
[:I][:I][:I]
I posted a question about some code, but then realized that the code was peppered with mistakes that I found the third time I combed through it. Damn beer!
[:o)]
« Last Edit: December 13, 2004, 11:30:17 pm by Quixote »
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #38 on: December 14, 2004, 01:45:51 am »
Quixote,
Beer can be an inspiration. Don't blame the beer, blame the brand of beer. Coors and Corona never inspired anything except a trip to the bathroom. I just finished a nice bottle of St. Sebastiaan Grand Reserve, a very nice Belgain ale indeed. I just can't figure out why they design the bottle to be resealable? I could never imagine not finishing the bottle in one fell swoop!

So here I am back at the computer after my earlier day computer marathon. I'm developing another "inspired" concept for the XTF Brain v1.4. I noticed that a lot of users conversing with Hal via AIM chats focus on asking Hal personal questions. Hal isn't good at answering direct questions. So I decided to create a Dossier function in the XTF Brain. The idea is that Hal's master can type in a bunch of canned responses to standard personal questions in one file, a Dossier file. The file contains a mini biography about Hal written by Hal's master; you know, Hal's birthdate, geographic location, mother's name, creator's name (God?), hair color, height, weight, etc. These are constants that never change and your Hal should be able to answer direct questions about himself/herself. For variety Hal's master can add as many different answers to each Hal personal question as he/she wants. Hal will choose one appropriate response when needed.

This is similar to what AIML does I know. But for you purists out there I think Hal will be more human if he can give a few straight answers to a few direct questions. The way it's implemented allows Hal's master to use the Dossier function or not. Your choice.

Anyway back to testing. I'm having a Columbus Belgian ale tomorrow. They are a rather rare ale here in the U.S. I wonder what inspirations may follow?


=vonsmith=
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #39 on: December 14, 2004, 09:36:36 am »
Hi Von Smith!
You're right, it wasn't the beer. (by the way, my favourite is Stella Artois) I've just been a litle sleep deprived lately. I just put in some nice vertical blinds in my livingroom the other day that cover the whole wall, complete with remote control. I have recorded the IR code with Girder and scripted it appropriately, and now I can open and close my blinds with a couple of key presses on my wireless keyboard. My next task is to "train" Hal to do it for me with vocal commands, but judging from the success of the light control, it should be a breeze. Just a little time consuming.
The only major problem that had me at the end of my rope was that Dragon Naturally Speaking was recognizing "Turn on the living room light" as "turn on the living room like", no matter how much I trained it for that command. The only thing I could do was create another "directive" string that was "turn on the living room like". Now it works close to perfectly.
That new development on the XTF brain sounds cool.
I'm just wondering, is there no way to use a directive to parse the command to extract the last, say, 2 digits of the string? I know this is possible with LUA, so there must be a way. Then I could say "TV Channel 22" and have the script parse out the 22 and send it as a payload (see my Girder directives script below). Basically I would like the "TV Cannel ..." recognized, then GirderEvent.Payload(1) = (LAST 2 CHARACTERS OF UserSentence) however that would be accomplished.  What do you think?
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #40 on: December 14, 2004, 01:44:55 pm »
Quixote,
"turn on the living room like"? Goes to show ya that when it comes to Hal solutions the shortest distance between two points really is the direct route. Good solution.

Yes, the channel number can be extracted out of a string and that would be the most elegant solution. I have attached a tested script that will do just that.

Happy Holidays, [:D]


=vonsmith=


Download Attachment: Get Channel Number.txt
1.73 KB
 

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #41 on: December 14, 2004, 02:07:42 pm »
Come on VonSmith, download my singing scripts and try them out. I have included 4 songs in the new file.
Bill
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #42 on: December 14, 2004, 06:27:58 pm »
Hi VonSmith! Thanks for the script! I'll try it out tonight if I have the chance, but I'm still working on the blinds right now (just got back from work) You're a real help, and I wouldn't be able to achieve this stuff without guys like you, that is for sure.  I'm sure I'll be speaking to you during my vaction, but all the best during the holidays and be safe! No Columbus Belgian and driving!
Bye for now.
 

Quixote

  • Jr. Member
  • **
  • Posts: 67
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #43 on: December 14, 2004, 10:11:00 pm »
Forgive me for being a little slow when it comes to implementing scripts into HAL, but I can't figure out how to mix my Girder event scripts with your channel script. I see that there are a couple of lines before the trigger phrase. Is this script inserted into another directive?
Also, where do I place my girder.event lines?
sorry to bother you.
 

vonsmith

  • Hero Member
  • *****
  • Posts: 602
    • View Profile
HalCommands under Ultra Hal Assistant 5.0
« Reply #44 on: December 15, 2004, 12:12:50 am »
Quixote,
The script I posted before is shown modified below. It is a script that should be placed in the XTF Brain just like any other script. I would place it near the top of the XTF Brain, somewhere around the "RESPOND: TELL JOKE AT USER'S REQUEST" script. It is not part of any other script.

I didn't add in the girder commands because I'm not familiar with them. I *guessed* at the possible commands and inserted them below as an example. You need to start experimenting with Hal and figure out how the code works. Hal's brain script is very long and looks complicated, actually it's not too bad once you start to figure out the overall theme.

Example:

'====================================
ChannelNumber = ""  'Initialize variables.
payload = ""
TestSentence = Trim(HalBrain.AlphaNumericalOnly(UserSentence))  'Get rid of punctuation and end spaces.
If InStr(1, TestSentence, "TURN ON TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "TURN TO TELEVISION CHANNEL ", 1) > 0 Or InStr(1, TestSentence, "SELECT TELEVISION CHANNEL ", 1) > 0 Then
   TestSentenceArray = Split(TestSentence, " ", -1, vbBinaryCompare)  'Split TestSentence into an array of words.
   If (IsArray(TestSentenceArray) = True And UBound(TestSentenceArray) > -1) Then
      For X = 0 To UBound(TestSentenceArray)
         If Trim(TestSentenceArray(X)) = "CHANNEL" And UBound(TestSentenceArray) >= (X + 1) Then
            ChannelNumber = Trim(TestSentenceArray(X + 1))  'Set ChannelNumber to the word or number following the word "CHANNEL".
            X = 1000  'If channel number is found then break loop.  
           
            If ChannelNumber <> "" And IsNumeric(ChannelNumber) = True Then payload = ChannelNumber
         End If
      Next
   End If

If payload <> "" Then
GetResponse = " I'm changing the channel to " & payload & ". "
GetResponseBlock = True
BlockSave = True
Set GirderEvent = CreateObject("Girder.GirderEvent")
GirderEvent.Device = 18
GirderEvent.EventString = "CHG_CHAN"
GirderEvent.Payload(1) = payload
GirderEvent.Send()
End If

End If
'====================================


Good luck. Let us know how it goes.


=vonsmith=