dupa

Author Topic: WordNet with Images - New For Hal 6  (Read 12895 times)

mikmoth

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • http://karigirl.com
WordNet with Images - New For Hal 6
« Reply #15 on: June 20, 2006, 08:32:12 pm »
I rewrote the whole thing from scratch Spydaz! Look at the first post. I am also including the Perl script! Have fun!
« Last Edit: June 20, 2006, 08:43:30 pm by mikmoth »
 

seduar

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
WordNet with Images - New For Hal 6
« Reply #16 on: June 21, 2006, 08:56:07 am »
Hi Mikmoth,

I am trying to paste the script to bring pictures and i have a question,
I do not know much about scripting but i am intereted in what you did, it sounds cool.
 What is 755 and how do i change it?.

 can you explain a little bit more about cahanging permition to 755?.
 

mikmoth

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • http://karigirl.com
WordNet with Images - New For Hal 6
« Reply #17 on: June 21, 2006, 12:41:47 pm »
Sorry if I didn't make it clear.

All most people need to do is copy/paste the text you see in the message into your brain. That's it.

If you are a more advanced user and you want to host the Perl script on your own server then you would download the attached script, upload it to your cgi-bin, and set the permissions of it to 755.

If you just want to get it working... copy this into your brain under the Wordnet Dictionary Function. Then load up Hal and type "Show me an airplane." or "Show me a deer." or whatever.

Code: [Select]
'RESPOND: LOOK UP IMAGE
If InStr(1, UserSentence, "SHOW YOU ", 1) > 0  Then
lookup = Replace(UserSentence, "SHOW YOU ", "", 1, -1, vbTextCompare)
If InStr(1,lookup,".", 1) > 0 Then lookup = Replace(lookup,".","",1,-1, vbTextCompare)
If InStr(1,lookup," A ", 1) > 0 Then lookup = Replace(lookup," A ","",1,-1, vbTextCompare)
If InStr(1,lookup," AN ", 1) > 0 Then lookup = Replace(lookup," AN ","",1,-1, vbTextCompare)
If WN.LookUpWord(lookup) = False Then
GetResponse = "I have no definition but I will try to find an image."
End If
If WN.LookupWord(lookup) = True Then
GetResponse = GetResponse & lookup & ": " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & "." & vbCrLf & "<EXCLUSIVE>"
End If
Set IE = CreateObject("InternetExplorer.Application")
cdc = "http://www.karigirl.com/cgi-bin/popup.pl?term=" + lookup + "&secs=5" 'Secs until window closes. 0=never
IE.Navigate cdc
IE.AddressBar = False
IE.menubar = False
IE.ToolBar = False
IE.StatusBar = False
IE.width = 450
IE.height = 450
IE.resizable = False
IE.visible = True
End If


« Last Edit: June 21, 2006, 12:52:46 pm by mikmoth »
 

seduar

  • Jr. Member
  • **
  • Posts: 71
    • View Profile
WordNet with Images - New For Hal 6
« Reply #18 on: June 21, 2006, 02:49:09 pm »
Thank you Mikmoth,

I Like this pluggin, but the window with the picture pops up behind hal, is there any way thgat the picture pops up infront and not on the back?
 

spydaz

  • Hero Member
  • *****
  • Posts: 670
    • View Profile
    • http://www.spydazweb.co.uk/
WordNet with Images - New For Hal 6
« Reply #19 on: June 21, 2006, 04:39:57 pm »
quote:
Originally posted by mikmoth

Sorry if I didn't make it clear.

All most people need to do is copy/paste the text you see in the message into your brain. That's it.

If you are a more advanced user and you want to host the Perl script on your own server then you would download the attached script, upload it to your cgi-bin, and set the permissions of it to 755.

If you just want to get it working... copy this into your brain under the Wordnet Dictionary Function. Then load up Hal and type "Show me an airplane." or "Show me a deer." or whatever.

Code: [Select]
'RESPOND: LOOK UP IMAGE
If InStr(1, UserSentence, "SHOW YOU ", 1) > 0  Then
lookup = Replace(UserSentence, "SHOW YOU ", "", 1, -1, vbTextCompare)
If InStr(1,lookup,".", 1) > 0 Then lookup = Replace(lookup,".","",1,-1, vbTextCompare)
If InStr(1,lookup," A ", 1) > 0 Then lookup = Replace(lookup," A ","",1,-1, vbTextCompare)
If InStr(1,lookup," AN ", 1) > 0 Then lookup = Replace(lookup," AN ","",1,-1, vbTextCompare)
If WN.LookUpWord(lookup) = False Then
GetResponse = "I have no definition but I will try to find an image."
End If
If WN.LookupWord(lookup) = True Then
GetResponse = GetResponse & lookup & ": " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "D") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "S") & ". " & WN.GetDefinition(WN.GuessPartOfSpeech, 1, "E") & "." & vbCrLf & "<EXCLUSIVE>"
End If
Set IE = CreateObject("InternetExplorer.Application")
cdc = "http://www.karigirl.com/cgi-bin/popup.pl?term=" + lookup + "&secs=5" 'Secs until window closes. 0=never
IE.Navigate cdc
IE.AddressBar = False
IE.menubar = False
IE.ToolBar = False
IE.StatusBar = False
IE.width = 450
IE.height = 450
IE.resizable = False
IE.visible = True
End If






http://images.google.com/images?q=mum <<<<<<<<<<<<<<  cdc

mikmoth

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • http://karigirl.com
WordNet with Images - New For Hal 6
« Reply #20 on: June 21, 2006, 07:49:50 pm »
That's how I had mine in the first place spydaz... but I dunno, I like just getting one big image myself. Oh... and you have to keep closing the window manually. Kinda lame...

« Last Edit: June 21, 2006, 07:55:39 pm by mikmoth »