Ai Dreams Forum

Chatbots => General Chatbots and Software => Topic started by: Freddy on July 09, 2011, 11:16:30 pm

Title: Question about Chatscript engine.
Post by: Freddy on July 09, 2011, 11:16:30 pm
I'm not being lazy, it's getting late here and I was hoping some clever person could help and I will wake up to something nice.

I'm messing around with some bot stuff in Visual Basic.

I was just wondering what form the engine takes, is there something like a DLL that I can plug into a VB project or is it more complex than that ?

Is there some documentation any where about how I may bring the engine into a VB project ?

Many thanks :)
Title: Re: Question about Chatscript engine.
Post by: JRowe on July 10, 2011, 12:48:54 am
Looks like it runs as a server, so you'd incorporate it by including the executable for whichever platform, and then start it up using your own parameters to specify the database/files etc you want to use.

It looks like a TCP interface on port 1024 (see the batch files) so I'd assume (at the risk of making an ass of myself :P ) that you'd simply start the server from the script, then initiate a TCP connection on port 1024, and proceed after the connection has been made successfully. So, it should be less complex to set up than using a DLL.
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 10, 2011, 01:19:13 am
Currently, ChatScript only has a CLI (Command Line Interface, in case the term is unknown to someone). I've written a GUI that accesses the ChatScript server that JRowe mentioned, and I'm more than happy to share the source code with you, to see how it operates, if you like. Since the GUI is still "third party" software, you'll have to have your own ChatScript server already implemented and running, but that's not a huge issue. A couple of things, though, that may prove useful:

1.) I'm not a professional programmer by any stretch of the imagination, so the code is a right mess.
2.) The GUI isn't finished yet, so it's possible that it's got bugs that I haven't found yet.
3.) (just to be contrary) The Speech Recognition and Text to Speech modules are still in development, too, so there WILL be bugs in that part. Both can be disabled, though. :)

Just let me know if you want to have a look, and I'll email you a zip file. That goes for anyone else, too; I just don't want to publicly post the zip right now, for various reasons.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 10, 2011, 07:38:36 am
Thanks guys, that doesn't sound too bad then.

GCC, of course...slaps forehead...I was going to look at your GUI, I have the link to your topic still sitting here on my desktop. So is that VB then ? I had toyed with learning C# but I am not sure if I want to make the effort at the moment. VB I have used before and though I have forgotten a lot of it, I know it will slowly come back to me. Apparently they are about the same speed wise anyway. But that's beside the point.

I'll PM you an email you can use. My thanks :)

P.S. don't worry about messy code ;)
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 10, 2011, 07:41:10 am
Ok. :)
Title: Re: Question about Chatscript engine.
Post by: mendicott on July 10, 2011, 03:10:20 pm
It sure would be nice if there were some kind of SaaS interface for Chatscript, like Pandorabots.  In fact, I would love to have a Chatscript engine API available online.  This is inline with my "Open Chatbot Standards" or "Open Chatbot Framework" concepts of modularity, maximum plug and play for everyman.
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 10, 2011, 03:33:56 pm
I tried to set up a ChatScript server on my website, but due to hosting restrictions, the only port I could have set it up on was HTTP port 80, which would have ended up replacing my site with nothing but the CS server, and that was just not acceptable. I may, at some point, see about registering another domain name, and host a dedicated CS server, but that will have to wait until my finances get a little more stable.
Title: Re: Question about Chatscript engine.
Post by: Art on July 11, 2011, 01:44:38 am
<clipped>... but that will have to wait until my finances get a little more stable.

Yeah...just like when they say, "I think we'll wait until we can afford to have children first."

If THAT was the case, there'd be a whole lot less people on the planet!!

Bottom line...you do the best you can when you can with what you can. Can I hear a YeeHaw!!!
(I do hear where yer coming from  brother!) ;)
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 11, 2011, 02:27:00 am
lol, thanks, Art.

You know, we haven't talked in a while. Are you busy over the next few days?
Title: Re: Question about Chatscript engine.
Post by: Art on July 11, 2011, 10:38:58 am
Yeah, back from vacay and back to that other FOUR LETTER WORD...

W - O - R - K

I hate when that happens!

(I'll give ya a shout one day after work).
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 11, 2011, 01:21:53 pm
Welcome back Art, I hope you had a nice break at least :)

GCC, dedicated servers cost a fortune, would a VPS (Virtual Private Server) do the trick ?

Actually considering it's just text being volleyed around it might work out cheaper to actually buy a cheap PC/Server and set it up at home...
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 11, 2011, 01:30:43 pm
Freddy, I'm not familiar with the term, though I suspect you're referring to a server that's setup with a VPN (virtual Private Network) tunnel? If so, I'm not certain how that would work, since the VPN connection would have to use the port that's dedicated to VPN connections, and the CS server would require access to a different port entirely. I'm not sure how one could switch ports in a manner that would allow access to the ChatScript server without losing the VPN connection. (this is one of those situations where my 'self-education' illuminates a huge, glaring hole in my knowledge)
 Of course, I understand that you could be referring to something else that uses a similar name, and I could be way off base here, so further explanation may help. :)
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 11, 2011, 01:41:26 pm
This is what I mean : http://en.wikipedia.org/wiki/Virtual_private_server (http://en.wikipedia.org/wiki/Virtual_private_server)

I've been toying with the idea of trying one for a while now.

I'm a bit foggy on the details, but it's like the midway point between shared hosting and dedicated servers.

Unfortunately my knowledge stops at the port configuration, but a simple enquiry to some service provider would probably be sufficient - ie, do they allow it to listen on different ports...
Title: Re: Question about Chatscript engine.
Post by: Bragi on July 11, 2011, 01:51:52 pm
basically, as far as I understand it, shared hosting is when your site (hosting package,..) is shared on the same OS, while with a VPS, they use these virtualization tools to create virtual hardware. This way, they can offer an entire os for you alone: it's completely boxed in.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 11, 2011, 01:56:02 pm
Yep that's my understanding too.
Title: Re: Question about Chatscript engine.
Post by: Bragi on July 11, 2011, 02:24:28 pm
well, my tiny little dog just decided to take a nose dive off a 3 meter high rooftop. Off to the vet I guess.   :-\
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 11, 2011, 03:20:10 pm
Jan, I hope your pooch is ok. Sorry to hear that it failed to master the fundamentals of flight in time. :(
That explains it, Freddy. I'd heard of VDS before, as it's a common practice with some hosting companies. I'd not heard of it being called VPS though. I'll explore pricing options for that sort of thing, and see if it's something that I can swing.
Title: Re: Question about Chatscript engine.
Post by: Bragi on July 11, 2011, 04:59:07 pm
back from the vet, no broken bones ( :P ), 3 paws should be fine, the 4th needs some more healing. 2 weeks rest (hard for a dog)
That fence is a coming back up :tickedoff:
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 12, 2011, 08:27:22 pm
Oh not too bad then, poor doggy.
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 12, 2011, 08:50:06 pm
How's the GUI code looking, Freddy?
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 15, 2011, 02:42:57 pm
I'm having a little difficulty actually.  What IDE did you use to make it ?

And should I be installing the ChatScript engine first ?

 :uglystupid2:
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 15, 2011, 03:21:14 pm
Yes, you should have ChatScript up and running first; and the program was written in Visual Basic, using Visual Studio 2008. What sort of error are you having, and which OS are you developing on?
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 15, 2011, 03:23:14 pm
Ah right okay.... I'll go and figure out how to install CS now.

My OS in Windows 7, I'm using Visual Studio 2010...

Back in a bit.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 15, 2011, 03:33:49 pm
OK, with regard to the CS engine, do I simply have to run the chatscript.exe to get the server up and running ?  It comes up with a CLI and seems to work fine like that.

Now on to your GUI.  It appears to have converted okay to VB 2010, but I get the following error when trying to run it :

Quote
{"An error occurred creating the form. See Exception.InnerException for details.  The error is: Could not load file or assembly 'Interop.SpeechLib, Version=5.4.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. An attempt was made to load a program with an incorrect format."}
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 15, 2011, 03:42:57 pm
Ok, the problem with that is probably that you'll have to remove the reference to the SpeechLib DLL, and locate/reference the same DLL that's in Win 7. This is one of the difficulties with writing programs on an older OS and running said programs on a new OS. (it seems to me that when I wrote StickyNotes we had similar problems)

As for running CS as a server, look in the CS directory for server.bat and run that. Then minimize the window, because nothing at all interesting will happen there.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 15, 2011, 04:04:17 pm
I was using speechLib just the other day funnily enough.  I copied the dll from my new project over to this one, but still no go.

I have been away from VB too long to figure out what's going on very quickly.

Two errors now :

Quote
Error   1   Unable to open module file 'C:\Users\me\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.vb': System Error &H80041feb&   C:\Users\me\AppData\Local\Temp\.NETFramework,Version=v4.0.AssemblyAttributes.vb   1   1   ChatScriptGUI

Quote
Error   2   Interop type 'SpSharedRecoContextClass' cannot be embedded. Use the applicable interface instead.   C:\Users\me\Downloads\ChatScriptGUI\ChatScriptGUI\Form1.vb   45   27   ChatScriptGUI

But yeah going from one version of VB to the next is always a pain in the bottom.  Do those make any sense to you ?
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 15, 2011, 04:29:15 pm
A quick Google search turned up this article from the MSDN blogs:

http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx (http://blogs.msdn.com/b/mshneer/archive/2009/12/07/interop-type-xxx-cannot-be-embedded-use-the-applicable-interface-instead.aspx)

Give that a quick read, and see if it helps. That's about the best I can offer for now.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 15, 2011, 05:48:58 pm
Okay thanks.  I think I will refer to your code and try to write something rather than spend time trying to get the whole application to convert.  Cheers  O0
Title: Re: Question about Chatscript engine.
Post by: Bragi on July 16, 2011, 09:07:42 am
gcc, are you still using vb6 or are you using one of the vb.net versions?
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 16, 2011, 12:12:46 pm
I've got Visual studio 2008, but I've not really explored all of it's possibilities beyond VB.net. Add to that the fact that everything I know of any programming language is what I've learned on my own and... well... :)
Title: Re: Question about Chatscript engine.
Post by: Bragi on July 16, 2011, 01:18:51 pm
My bad, I was mixing the interop problems with the speechlib issue. Otherwise I would have asked why not use the .net versions?
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 16, 2011, 05:30:02 pm
OK well I seem to to be doing something right.  I picked out the server connection part from your script Dave thanks.

I'm getting a response from the bot and that is 'I don't know what to say'...

I think that's it isn't it ?  Are there any bots yet we can load up ?
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 16, 2011, 05:32:42 pm
You may want to ask Bruce. I have a minimal bot file for Morti, that covers some of the rudimentary stuff, but I haven't delved into it all that much yet. More irons in the fire than I care to admit.

If you like, I'll zip them up, and email them to you.
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 16, 2011, 05:51:56 pm
To be honest at the moment I wouldn't know what to do with them.

Is there a difference between the bot harry in the exe and the server one ?

I mean for example, if I ask Harry (exe) 'What is your name ?', he replies my name is Harry.

Yet on the server version it says 'I don't know what to say'.

Presumably I am missing moving files to some place - probably the LIVEDATA folder yes ?

Probably should read the manual  :idiot2:
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 16, 2011, 06:41:22 pm
This is a bit daft, but how do you import SpeechLib ?

I did it the other day, but for the life of me I cannot figure out how to do it now.  :tickedoff:
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 16, 2011, 06:50:25 pm
Look in %programFiles% (both _X86 and _X64) for SAPI5.dll, and add the file as a reference. Then place at the beginning of the class declaration for your main form, "Imports SpeechLib". That should take care of it.

At least, That's what I did. :)
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 16, 2011, 06:54:00 pm
Oops? I lied. Do an advanced search on your computer for *SpeechLib.dll - and add that file as a reference. SAPI5.dll was an earlier (failed) attempt at making SR and TTS work. Sorry. :)
Title: Re: Question about Chatscript engine.
Post by: Freddy on July 16, 2011, 07:02:00 pm
Ahh...well I think it's changed maybe, not sure to be honest, that must be the way i did it before and I found the dll, but I swear it did that automagically before somehow  :-\

I managed to find that sapi.dll exists.  Under references on my system it comes up as Microsoft Speech Object Library, and then when you click okay to add it it appears in the solution explorer as 'Interop.SpeechLib'

So something changed somewhere.  It appears to work okay anyway.

I so wish the add references section had a search function, it's full of stuff and you can easily miss things like I did.  :knuppel2:
Title: Re: Question about Chatscript engine.
Post by: DaveMorton on July 16, 2011, 07:47:22 pm
That's been my experience, as well, so don't feel bad. I usually get done what I need to, though. :)