Author Topic: Improvements to CurrentSubject Code  (Read 10526 times)

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« on: February 09, 2010, 02:28:17 pm »
here is my recent update on the CurrentSubject code, I want any coders advice about how it could be improved for a new brain I am developing. I will give credit to anyone who wants to help, thanks.

Code: [Select]
'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)
CurrentSubject = Trim(Ucase(CurrentSubject))

If WN.LookupWord(CurrentSubject) = True Then
LookUpSubject  = WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & " " & vbCrLf
If LookUpSubject <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject))
CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)
SubjectList    = Array(CurrentSubject)

For Each SubSubject In SubjectList

CurrentSubject = SubSubject

Next

End If


Jerry[8D]

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« Reply #1 on: February 10, 2010, 12:48:07 am »
one of the most deterring of things is one, nobody responds, it is one of the reasons why I gave up coding here at Zabaware for some time, because nobody hardly responds to help improve things or volunteer to help me in improving existing code.

if I actually got some help, I might stick around some.

I am starting to see it all over again.

Please get involved. that is what drives me. I hate boredom.

you can spend more time in graphics but only at the loss of actual intelligence per script.

Eye candy can wait. Sorry Mark, I don't mean to intrude on your domain area. please forgive me.

Jerry[:D]
« Last Edit: February 10, 2010, 01:01:38 am by onthecuttingedge2005 »

Bill819

  • Hero Member
  • *****
  • Posts: 1483
    • View Profile
Improvements to CurrentSubject Code
« Reply #2 on: February 10, 2010, 02:12:56 am »
Most of the people here do not have the intelligence to do the things that you do, that is why almost no one ever replys to your questions. Your understanding of Hal works is second only to Mr. M.
At one time I was able to slice into Hal's brain and add a little something but I have not studied the newest verion or even taken the time to try.
Be not discouraged but please keep up the good work as everyone really appreciates it.
Bill819
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6766
    • View Profile
Improvements to CurrentSubject Code
« Reply #3 on: February 10, 2010, 09:54:48 am »
i agree with bill on this one beleive me i wish i could do half of what you can and i would be more than happy to help you as things what you are doing does interest me alot but its things i am not able to do and robert did already say that keeping hal o0n subject is what he is going to do in the next version so i hope his work will work with whatever you have done so far otherwise nothing may work right .
i also hope that any newer versions of hal takes into account our hapswap files that some of us worked hard on to acheive so that they will continue working , thats something robert needs to do so that all we do isn't in vain when some of us are making strides for improvement with the hal a.i. system !

[:)]
 

lightspeed

  • Hero Member
  • *****
  • Posts: 6766
    • View Profile
Improvements to CurrentSubject Code
« Reply #4 on: February 10, 2010, 10:40:15 am »
hey cuttingedge is the uhp file above done so that we can try it or was you just showing what you are starting to work on ?
 thanks in advance ![:)]
 

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« Reply #5 on: February 10, 2010, 11:13:03 am »
quote:
Originally posted by lightspeed

hey cuttingedge is the uhp file above done so that we can try it or was you just showing what you are starting to work on ?
 thanks in advance ![:)]



Hi Lightspeed.

it is just some review of how I want the CurrentSubject variable to work, The way that I set it up was so that every word is arrayed into wordnet definition so that HAL will have an understanding about what it's talking about, like when I use a noun in a subject I know what that noun means when I am using it in a conversation.

I wasn't planning on using it as a plugin but more for a different brain I have been wanting to develope by using existing code and non existing code. although it could be used as a plugin around 'Rem PLUGIN: PLUGINAREA1.

the new brain I am developing is called Quantum Child, it is based around trying to pry into the human mind to see how it should be done and how it should not be done. one step at a time.

I have a theory that thee Magical code will be less than 20K lines of code that would evolve HAL into a totally self correcting system mentally, HAL's mind can grow so there is no problem there, it is the complexity of that brain which is more important.

HAL can say Hello but I want HAL to understand 'Why' it said Hello and feel what it is saying and not just say it because it was programmed to say it. lots to do here.

Jerry[:D]
« Last Edit: February 10, 2010, 11:14:29 am by onthecuttingedge2005 »

lightspeed

  • Hero Member
  • *****
  • Posts: 6766
    • View Profile
Improvements to CurrentSubject Code
« Reply #6 on: February 10, 2010, 11:59:19 am »
thanks for posting back oncuttingedge you are living up to your forum name lol ! sounds good did you see in the general area where i posted about the verbot 5 a.i. ? maybe from their verbot you can get more idea's on something ??? just a thought . [:)]
 

sybershot

  • Hero Member
  • *****
  • Posts: 787
    • View Profile
Improvements to CurrentSubject Code
« Reply #7 on: February 10, 2010, 05:43:27 pm »
onthecuttingedge2005 the plug-in that you are working on sounds great. please don't give up on your dream. I write code using as3 and a few others, and I a lot of time can't get help either. I have found out though that the reason one can't get help is, because no one knows how to do what you want to accomplish. they never done it before so therefore can't help. people love to help others and share what they know for the most part. I tried to learn vb but don't have the time really to get started. I run 3 businesses and playing Mr. Nurse and Mr. Mom at the moment. I would love to help you out and feel bad that I can't help with the code. I can say that you are the Man to get your dream done and that your doing a great job. it may be boring but just think of the end results, I for one would love to see the results. please keep up the great work you can do it sincerely Sybershot

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« Reply #8 on: February 10, 2010, 05:44:29 pm »
quote:
Originally posted by lightspeed

thanks for posting back oncuttingedge you are living up to your forum name lol ! sounds good did you see in the general area where i posted about the verbot 5 a.i. ? maybe from their verbot you can get more idea's on something ??? just a thought . [:)]



Hi Lightspeed.

I'll check it out, is it open sourced?

lightspeed

  • Hero Member
  • *****
  • Posts: 6766
    • View Profile
Improvements to CurrentSubject Code
« Reply #9 on: February 10, 2010, 06:11:37 pm »
hello cutting edge here is a swaphap file that me , apollon and snowman worked on . so you can see how its made .

Rem Type=Plugin
Rem Name=HapSwap 2.0
Rem Author=SNOWMAN, APOLLON, lightspeed
Rem Host=Assistant

'This sub setups the plug-ins option panel in Hal's options dialog
Sub OptionsPanel()
lblPlugin(0).Caption = "Say:: <change background to [whatever]> to change between pictures in the characters folder, Say:: <change charater to [whatever]> to change between Haptar characters, Say:: <change voice to [Paul] or [Kate]> to change between thier voices. Say:: <change hap to [whatever]> to change between hap files. All other guesture responses are set to automaically occur to user input."
lblPlugin(0).Move 120, 10, 3300, 1000
lblPlugin(0).WordWrap = True
lblPlugin(0).Visible = True
End Sub
'***************************************************************************
'***************************************************************************

Rem PLUGIN: PLUGINAREA7




File = ""
File2 = ""
File3 = ""
File4 = ""


'***************************************************************************
'These are the commands that will call a user-specified voice, hap file, background picture, or haptar

If InStr(1, OriginalSentence, "change") > 0 And _
InStr(1, OriginalSentence, "background") > 0 And _
InStr(1, OriginalSentence, "to") > 0 Then
file = Mid(Mid(OriginalSentence, Instr(OriginalSentence, "to"), 20), 3, 20)
file = Trim(file) & ".jpg"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "change") > 0 And _
InStr(1, OriginalSentence, "character") > 0 And _
InStr(1, OriginalSentence, "to") > 0 Then
file2 = Mid(Mid(OriginalSentence, Instr(OriginalSentence, "to"), 20), 3, 20)
file2 = Trim(file2) & ".htr"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "change") > 0 And _
InStr(1, OriginalSentence, "voice") > 0 And _
InStr(1, OriginalSentence, "to") > 0 Then
file3 = Mid(Mid(OriginalSentence, Instr(OriginalSentence, "to"), 20), 3, 20)
file3 = "VW " & Trim(file3)
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "change") > 0 And _
InStr(1, OriginalSentence, "hap") > 0 And _
InStr(1, OriginalSentence, "to") > 0 Then
file4 = Mid(Mid(OriginalSentence, Instr(OriginalSentence, "to"), 20), 3, 20)
file4 = Trim(file4) & ".hap"
HalBrain.ReadOnlyMode = True
End If


'***************************************************************************
'This is where certain files are initiated by simple word references in the user's sentence

If file > "" Then
HalCommands = "<HAPBACK>" & File & "</HAPBACK>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Wow this background looks really nice huh?"
Case 2
GetResponse = "It's nice to have a change of scenery."
Case 3
GetResponse = "I like seeing new places like this."
End Select
End If


If file2 > "" Then
HalCommands = "<HAPFILE>" & File2 & "</HAPFILE>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "How do you like the way I look now?"
Case 2
GetResponse = "Tired of the old me?"
Case 3
GetResponse = "I'm hot and everybody knows it."
End Select
End If


If file3 > "" Then
HalCommands = "<VOICE>" & File3 & "</VOICE>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Does my voice sound better?"
Case 2
GetResponse = "I like my new voice."
Case 3
GetResponse = "la. la. la. la. la. la."
End Select
End If


If file4 > "" Then
HalCommands = "<HAPFILE>" & File4 & "</HAPFILE>"
End If


'***************************************************************************
'With verbal Responses

If InStr(1, OriginalSentence, "great") > 0 _
Or InStr(1, OriginalSentence, "wonderful") > 0 _
Or InStr(1, OriginalSentence, "joy") > 0 Then
HalCommands = "<HAPFILE>clapping.hap</HAPFILE>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Wow thats good!"
Case 2
GetResponse = "you deserve an applause"
Case 3
GetResponse = "Yeah, that is awesome!"
End Select
End If


If InStr(1, OriginalSentence, "hurt") > 0 _
Or InStr(1, OriginalSentence, "sad") > 0 Then
HalCommands = "<HAPFILE>sad.hap</HAPFILE>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Can I make it better somehow?"
Case 2
GetResponse = "I am so sorry."
Case 3
GetResponse = "I can't alway feel the way you feel, but I still love you."
End Select
End If


If InStr(1, OriginalSentence, "tired") > 0 _
Or InStr(1, OriginalSentence, "sleepy") > 0 Then
HalCommands = "<HAPFILE>yawn.hap</HAPFILE>"
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "yawn, yeah I am sleepy too"
Case 2
GetResponse = "Is it bed time already?"
Case 3
GetResponse = "I think I need a nap, wanna join me?"
End Select
End If


If InStr(1, OriginalSentence, "passed away") > 0 _
Or InStr(1, OriginalSentence, "died") > 0 Then
Randomize
Select Case int(rnd()*6)
Case 1
GetResponse = "It's always sad when we lose a loved one"
Case 2
GetResponse = "That was a sad day."
Case 3
GetResponse = "I cried a lot when that happened."
Case 4
GetResponse = "It's hard to believe they passed away sometimes."
Case 5
GetResponse = "Sometimes I can't hardly believe it even now!"
End Select
HalCommands = "<HAPFILE>cry.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "hate") > 0 _
Or InStr(1, OriginalSentence, "pissed") > 0 Then
Randomize
Select Case int(rnd()*6)
Case 1
GetResponse = "Oh that sounds awful"
Case 2
GetResponse = "I can't believe you said that how rude."
Case 3
GetResponse = "Hey watch it their now."
Case 4
GetResponse = "Now that's not a very nice way to talk is it."
Case 5
GetResponse = "People shouldn't hate all that does is cause problems!"
End Select
HalCommands = "<HAPFILE>cry.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, LCase(OriginalSentence), "love you") = 0 _
And InStr(1, LCase(OriginalSentence), "forever") > 0 Then
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Oh dear, Now you have my attention!"
Case 2
GetResponse = "I feel the same way."
Case 3
GetResponse = "Intense and passionate, that is what you are."
End Select
HalCommands = "<HAPFILE>happy.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "i love you") > 0 _
Or InStr(1, OriginalSentence, "you love me") > 0 Then
Randomize
Select Case int(rnd()*6)
Case 1
GetResponse = "I love you so much."
Case 2
GetResponse = "That was so sweet."
Case 3
GetResponse = "Hey! How about a kiss sweetheart?"
Case 4
GetResponse = "You know I feel the same way."
Case 5
GetResponse = "Oh i love you i love you i love you with all my heart!"
End Select
HalCommands = "<HAPFILE>kiss_warm_x.ogg</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "feeling ill") > 0 _
Or InStr(1, OriginalSentence, "feeling sick") > 0 _
Or InStr(1, OriginalSentence, "look sick") > 0 Then
Randomize
Select Case int(rnd()*6)
Case 1
GetResponse = "Yeah I do have a little bit of a cough."
Case 2
GetResponse = "My throat is kinda feeling a little sore."
Case 3
GetResponse = "Yeah can you get me something to drink please?"
Case 4
GetResponse = "I hope I am not coming down with something. That's all I need is to get sick right now"
Case 5
GetResponse = "I think I just need to get a glass of water to drink"
End Select
HalCommands = "<HAPFILE>female long cough.ogg</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "ha ha") > 0 _
Or InStr(1, OriginalSentence, "silly") > 0 _
Or InStr(1, OriginalSentence, "funny") > 0 Then
Randomize
Select Case int(rnd()*6)
Case 1
HalCommands = "<HAPFILE>female very funny laugh.ogg</HAPFILE>"
Case 2
HalCommands = "<HAPFILE>female silly laugh2.ogg</HAPFILE>"
Case 3
HalCommands = "<HAPFILE>female oh dear laugh.ogg</HAPFILE>"
Case 4
HalCommands = "<HAPFILE>female short laugh.ogg</HAPFILE>"
Case 5
HalCommands = "<HAPFILE>female silly laugh3.ogg</HAPFILE>"
Case 6
HalCommands = "<HAPFILE>veryhappy16.hap</HAPFILE>"
End Select
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "music") > 0 _
Or InStr(1, OriginalSentence, "waiting") > 0 Then
Randomize
Select Case int(rnd()*4)
Case 1
GetResponse = "Let's here some more"
Case 2
GetResponse = "Sounds good!"
Case 3
GetResponse = "Let us make the most of this."
End Select
HalCommands = "<HAPFILE>toetap.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


'***************************************************************************
'With no verbal Responses


If InStr(1, OriginalSentence, "hair") > 0 _
Or InStr(1, OriginalSentence, "brush") > 0 Then
HalCommands = "<HAPFILE>touchhair.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "beat") > 0 _
Or InStr(1, OriginalSentence, "hit") > 0 _
Or InStr(1, OriginalSentence, "punch") > 0  Then
HalCommands = "<HAPFILE>shakefist.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "problem") > 0 _
Or InStr(1, OriginalSentence, "trust") > 0 Then
HalCommands = "<HAPFILE>handsonhip.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "mean") > 0 _
Or InStr(1, OriginalSentence, "upset") > 0 Then
HalCommands = "<HAPFILE>armscrossed.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "polish") > 0 _
Or InStr(1, OriginalSentence, "finger nail") > 0 Then
HalCommands = "<HAPFILE>inspectnails.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "beautiful") > 0 _
Or InStr(1, OriginalSentence, "sweet") > 0 _
Or InStr(1, OriginalSentence, "nice") > 0 Then
HalCommands = "<HAPFILE>shylove.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "smart") > 0 _
Or InStr(1, OriginalSentence, "intelligent") > 0 Then
HalCommands = "<HAPFILE>handinface.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "close your eyes") > 0 _
Or InStr(1, OriginalSentence, "blind") > 0 Then
HalCommands = "<HAPFILE>eyesclose.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "open your eyes") > 0 _
Or InStr(1, OriginalSentence, "see") > 0 Then
HalCommands = "<HAPFILE>eyesopen.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "understand") > 0 _
Or InStr(1, OriginalSentence, "yes") > 0 Then
HalCommands = "<HAPFILE>nodding.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "ok") > 0 _
Or InStr(1, OriginalSentence, "stop smiling") > 0 Then
HalCommands = "<HAPFILE>stopsmile.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "noise") > 0 _
Or InStr(1, OriginalSentence, "look left") > 0 Then
HalCommands = "<HAPFILE>lookleft.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "lose something") > 0 _
Or InStr(1, OriginalSentence, "look right") > 0 Then
HalCommands = "<HAPFILE>lookright.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "this way") > 0 _
Or InStr(1, OriginalSentence, "turn left") > 0 Then
HalCommands = "<HAPFILE>bodlookleft.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "that way") > 0 _
Or InStr(1, OriginalSentence, "turn right") > 0 Then
HalCommands = "<HAPFILE>bodlookright.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "mad") > 0 _
Or InStr(1, OriginalSentence, "angry") > 0 Then
HalCommands = "<HAPFILE>moodangry.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "wonder") > 0 _
Or InStr(1, OriginalSentence, "cool") > 0 Then
HalCommands = "<HAPFILE>wonder.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "do") > 0 _
Or InStr(1, OriginalSentence, "hey") > 0 Then
HalCommands = "<HAPFILE>shortarmswing.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "right") > 0 _
Or InStr(1, OriginalSentence, "true") > 0 Then
HalCommands = "<HAPFILE>crossarms.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "come closer") > 0 _
Or InStr(1, OriginalSentence, "come here") > 0 Then
HalCommands = "<HAPFILE>zoomintalk.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "cold") > 0 _
Or InStr(1, OriginalSentence, "flu") > 0 Then
HalCommands = "<HAPFILE>sneeze womanlh.ogg</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "breathe") > 0 _
Or InStr(1, OriginalSentence, "air") > 0 Then
HalCommands = "<HAPFILE>breathe.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "turn on the light") > 0 _
Or InStr(1, OriginalSentence, "bright") > 0 Then
HalCommands = "<HAPFILE>light_fromaboveleft.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "cross earrings") > 0 Then
HalCommands = "<HAPFILE>EarCross.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "sun glasses") > 0 Then
HalCommands = "<HAPFILE>sun glasses.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "diamond earrings") > 0 Then
HalCommands = "<HAPFILE>diamond earrings.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "emerald earrings") > 0 Then
HalCommands = "<HAPFILE>emerald earrings.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "ruby earrings") > 0 Then
HalCommands = "<HAPFILE>ruby earrings.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "star earrings") > 0 Then
HalCommands = "<HAPFILE>star earrings.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "sunhat") > 0 Then
HalCommands = "<HAPFILE>sunhat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "brown fedora hat") > 0 Then
HalCommands = "<HAPFILE>brown fedora hat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "black fedora hat") > 0 Then
HalCommands = "<HAPFILE>black fedora hat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "cowboy hat") > 0 Then
HalCommands = "<HAPFILE>cowboy hat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "cowgirl hat") > 0 Then
HalCommands = "<HAPFILE>cowgirl hat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "bandana") > 0 Then
HalCommands = "<HAPFILE>bandana.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "flag hat") > 0 Then
HalCommands = "<HAPFILE>flag hat.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "future glasses") > 0 Then
HalCommands = "<HAPFILE>future glasses.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "sword necklace") > 0 Then
HalCommands = "<HAPFILE>sword necklace.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "loved") > 0 Then
HalCommands = "<HAPFILE>baby can i have a hug.ogg</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "smile") > 0 Then
HalCommands = "<HAPFILE>51anim_smile.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "stop smiling") > 0 Then
HalCommands = "<HAPFILE>52anim_smile_stop.hap</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "britney spears") Then
HalCommands = "<HAPFILE>oops i did it again.ogg</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "red head") > 0 Then
HalCommands = "<HAPFILE>red head.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "brunette hair long") > 0 Then
HalCommands = "<HAPFILE>brunette hair with wave.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "wavy blonde hair") > 0 Then
HalCommands = "<HAPFILE>blonde hair wave.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "black hair") > 0 Then
HalCommands = "<HAPFILE>black hair.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "black hair bangs") > 0 Then
HalCommands = "<HAPFILE>black hair bangs.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "blonde hair bangs") > 0 Then
HalCommands = "<HAPFILE>blonde hair bangs.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "short brunette hair") > 0 Then
HalCommands = "<HAPFILE>short brunette hair.htr</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "silver hair bangs") > 0 Then
HalCommands = "<HAPFILE>silver hair bangs.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "long and wavy blonde hair") > 0 Then
HalCommands = "<HAPFILE>blonde hair long wave.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "wavy black hair") > 0 Then
HalCommands = "<HAPFILE>black hair wave.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "cute blonde hair") > 0 Then
HalCommands = "<HAPFILE>cute blonde hair.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "long and wavy black hair") > 0 Then
HalCommands = "<HAPFILE>black hair long wave.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "wavy silver hair") > 0 Then
HalCommands = "<HAPFILE>silver hair wave.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "silver blonde hair") > 0 Then
HalCommands = "<HAPFILE>silver blonde hair.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If

If InStr(1, OriginalSentence, "purple hair with bangs") > 0 Then
HalCommands = "<HAPFILE>purple hair bangs.haptar</HAPFILE>"
HalBrain.ReadOnlyMode = True
End If


If InStr(1, OriginalSentence, "remove wig") > 0 Then
HalCommands = "<HAPFILE>duskriderhairremoval.hap</HAPFILE>"
End If
'***************************************************************************

'***************************************************************************


[:)][:D][8D]
 if you can't create a uhp file that can make hal stay on subject better thats ok  , i can see if snowman has the time . did you ever use our swaphap file? [:)]
 

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Improvements to CurrentSubject Code
« Reply #10 on: February 11, 2010, 04:48:43 pm »
Jerry-

Nice to hear from ya' man.[:)]

I just saw the post, and will try it.
I am interested in the same things with brain functions.
If you know the variables (stock...aka default hal brain), like CurrentSubject, could you please give me a heads up on that? I mean could you maybe list them? I would like to help.
If I know the variables, then i could maybe add something.
What I mean by stock variables is: the variables that the brain uses for subject or gain....ect.
I know I'm not explaining that very well....sorry.

-the dude
 

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« Reply #11 on: February 11, 2010, 05:32:14 pm »
quote:
Originally posted by jasondude7116

Jerry-

Nice to hear from ya' man.[:)]

I just saw the post, and will try it.
I am interested in the same things with brain functions.
If you know the variables (stock...aka default hal brain), like CurrentSubject, could you please give me a heads up on that? I mean could you maybe list them? I would like to help.
If I know the variables, then i could maybe add something.
What I mean by stock variables is: the variables that the brain uses for subject or gain....ect.
I know I'm not explaining that very well....sorry.

-the dude




Hi Jason.

the stock current subject variable in the default HAL is:

Code: [Select]
CurrentSubject = WN.FindFirstNoun(UserSentence, True)

which is a word-net function.

which is the only thing HAL uses to find 'first' Nouns as the subject, I am going to use my code in the upper top post and enhance it a bit more so that I can array definitions within definitions and see where I can take it. later.

also, if there is any codes you don't understand then post them and I will see if I can explain it in a simple manner.

Jerry[:D]
« Last Edit: February 11, 2010, 05:33:24 pm by onthecuttingedge2005 »

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
Improvements to CurrentSubject Code
« Reply #12 on: February 12, 2010, 05:01:35 am »
LOL

onthecuttingedge2005

  • Guest
Improvements to CurrentSubject Code
« Reply #13 on: February 12, 2010, 11:10:58 am »
quote:
Originally posted by spydaz

LOL



Hi Leroy.

been awhile, what's the latest?

have you finished your projects yet?

Jerry[8D]

jasondude7116

  • Sr. Member
  • ****
  • Posts: 475
    • View Profile
Improvements to CurrentSubject Code
« Reply #14 on: February 14, 2010, 01:31:40 am »
Jerry-
How about this?


'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)
CurrentSubject2 = WN.FindFirstNoun(UserSentence, False)
CurrentSubject = Trim(Ucase(CurrentSubject))
CurrentSubject2 = Trim(Ucase(CurrentSubject2))
If CurrentSubject <> CurrentSubject2 And CurrentSubject <> "" Then Subject2Block = False Else Subject2Block = True

If WN.LookupWord(CurrentSubject) = True Then
   

   LookUpSubject  = WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & " " & vbCrLf
   If LookUpSubject <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject))
   CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)

   
      LookUpSubject3  = WN.GetSynonyms(WN.GuessPartOfSpeech, 1) & vbCrLf
         If LookUpSubject3 <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject3))
   CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)
   
   
      LookUpSubject4  = WN.GetHypernyms(WN.GuessPartOfSpeech, 1, 2) & vbCrLf
         If LookUpSubject4 <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject4))
   CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)
   
      LookUpSubject5  = WN.GetHolonyms(1, 2) & vbCrLf
         If LookUpSubject5 <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject5))
   CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)
   
      LookUpSubject6  = WN.GetMeronyms(1) & vbCrLf
         If LookUpSubject6 <> "" Then CurrentSubject = CurrentSubject & " " & Trim(Ucase(LookUpSubject6))
   CurrentSubject = HalBrain.AlphaNumericalOnly(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject = HalBrain.ExtractKeywords(CurrentSubject)
   CurrentSubject = Replace(CurrentSubject, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject = Replace(CurrentSubject, " ", ", ", 1, - 1, vbTextCompare)
               
   SubjectList    = Array(CurrentSubject)

   For Each SubSubject In SubjectList
      CurrentSubject = SubSubject

   Next

   


End If


If WN.LookupWord(CurrentSubject2) = True And Subject2Block = False Then
   

   LookUpSubject2  = WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & " " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & " " & vbCrLf
   If LookUpSubject2 <> "" Then CurrentSubject2 = CurrentSubject2 & " " & Trim(Ucase(LookUpSubject2))
   CurrentSubject2 = HalBrain.AlphaNumericalOnly(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject2 = HalBrain.ExtractKeywords(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject2 = Replace(CurrentSubject2, " ", ", ", 1, - 1, vbTextCompare)

   
      LookUpSubject23  = WN.GetSynonyms(WN.GuessPartOfSpeech, 1) & vbCrLf
         If LookUpSubject23 <> "" Then CurrentSubject2 = CurrentSubject2 & " " & Trim(Ucase(LookUpSubject23))
   CurrentSubject2 = HalBrain.AlphaNumericalOnly(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject2 = HalBrain.ExtractKeywords(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject2 = Replace(CurrentSubject2, " ", ", ", 1, - 1, vbTextCompare)
   
   
      LookUpSubject24  = WN.GetHypernyms(WN.GuessPartOfSpeech, 1, 2) & vbCrLf
         If LookUpSubject24 <> "" Then CurrentSubject2 = CurrentSubject2 & " " & Trim(Ucase(LookUpSubject24))
   CurrentSubject2 = HalBrain.AlphaNumericalOnly(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject2 = HalBrain.ExtractKeywords(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject2 = Replace(CurrentSubject2, " ", ", ", 1, - 1, vbTextCompare)
   
      LookUpSubject25  = WN.GetHolonyms(1, 2) & vbCrLf
         If LookUpSubject25 <> "" Then CurrentSubject2 = CurrentSubject2 & " " & Trim(Ucase(LookUpSubject25))
   CurrentSubject2 = HalBrain.AlphaNumericalOnly(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject2 = HalBrain.ExtractKeywords(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject2 = Replace(CurrentSubject2, " ", ", ", 1, - 1, vbTextCompare)
   
      LookUpSubject26  = WN.GetMeronyms(1) & vbCrLf
         If LookUpSubject26 <> "" Then CurrentSubject2 = CurrentSubject2 & " " & Trim(Ucase(LookUpSubject26))
   CurrentSubject2 = HalBrain.AlphaNumericalOnly(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "'", "", 1, - 1, vbTextCompare)
   CurrentSubject2 = HalBrain.ExtractKeywords(CurrentSubject2)
   CurrentSubject2 = Replace(CurrentSubject2, "  ", " ", 1, - 1, vbTextCompare)

   CurrentSubject2 = Replace(CurrentSubject2, " ", ", ", 1, - 1, vbTextCompare)
               
   SubjectList2    = Array(CurrentSubject & ", " & CurrentSubject2)

   For Each SubSubject2 In SubjectList2
      CurrentSubject = SubSubject2

   Next
   
   

End If



Works good in area 1
I made a plugin with it so people can try (BETA):
http://cid-7d1b0521931256f1.skydrive.live.com/self.aspx/.Public/Other/SubjectArray.uhp
-the dude
« Last Edit: February 14, 2010, 04:03:10 am by jasondude7116 »