AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Gozins and Gozouts
 
 

Hey Bruce, I know you’re quite busy, so this is not a priority (obviously) just something to think about.

How hard would it be to have Chatscript “fed” from another program, to wit Pocketsphinx, which is also written in C++ iirc, and “feed” to another program, for example a Python front end?

I would think it’s just a few fairly simple stdin and stdout statements instead of what I suspect are cin and cout, but being an absolute beginner (just diving into learning) C++ I’m not really sure.

I hope all is well with you and yours, the move goes smoothly, and the jagoffs at 7whatever company that screwed you get their comeuppance in spades.

regards, Richard

 

 
  [ # 1 ]

ChatScript reads from stdin and writes using printf (which uses stdout).
So you tell me, what else do you need for piping in Linux? I’m not assuming you want to do such with windows.

 

 
  [ # 2 ]

The quick reply is: can you tell me where precisely the stdin and printf commands are?

It took me a good hour of writing editing, rethinking to get to that, I’ll post that internal discussion following this.

regards, Richard

 

 
  [ # 3 ]

The abridged long version:

This all goes back to the pm discussion we had a couple of months ago, I’m just now getting back to it, life has been painfully busy, unfortunately not in a good way. Anyhow, things seem to be fairly back on track so I’m back to my little project.

I have been working the past few days to develop an efficient way to pull Pocketshpinx output (the text from the asr) into the main python program then send it out to Chatscript instead of input from the keyboard.  It finally occurred to me why not send the Pocketsphinx output directly to Chatscript and then pipe the chatscript output to the Python main. Yes, I know, it’s obvious, they’re both C++, I shoulda thought of that in the first place. I’m down with the flu, my only defense your honor.

So where I’m at now is trying to find where the output (probably a printf as you said) from pocketsphinx_continuous sits, add something that would make it the stdin to Chatscript, modify Chatscript to accept that input instead of the keyboard, process that normally through Chatscript with the exception of a few direct commands such as “Move forward” which wold go to the Nav&Control; program and otherwise send the output to Festival speech sythesis (also in C++ unless I’m mistaken).  Based on our previous discussion, I COULD make Chatscript the “main” program and everything else “plug-ins”. I believe you told me in our discussion that Chatscript would be suitable for that “to an extent” which means I would either have to learn to program the AI in C++ or build a wrapper for the python AI to plug in to Chatscript.

Obviously still in the early stages of the design. The idea and the psuedocode architecture is there, the physical platform is built and the arduino control board installed and programmed so the bot can run around the room, do facial recognition and not bump into things to much, but other than that has no brain, so now it’s just deciding on the best choice for the rest and working towards that end.

The first step in that process is tying pocketshinx_continuous to Chatscript and then finding the code lines for Chatscript’s output to send either to Festival or…. the AI?

The more I talk about this “out loud” the more it sounds like I need to learn C++ and just walk away from python. <sigh>

regards, Richard

 

 
  [ # 4 ]

Oh, and definitely not in windows!

I receieved a reply from Nikolay over at CMU (re: Pocketsphinx asr output):

>When decoding a microphone pocketsphinx/src/programs/continuous.c line 323

>  hyp = ps_get_hyp(ps, NULL, &uttid;);
>  printf(”%s: %s\n”, uttid, hyp);
>  fflush(stdout);

and Alan at Festvox in Edinburgh (my favorite city in the world btw grin:

>  Its *much* easier to use it as either a server function (see the manual about that and festival/examples/festival_client.c

>  Or you might just want to use CMU Flite its C based and designed to be an embedded library

So the pocketsphinx output to Chatscript ought to be fairly straightforward for me to figure out, but the Festival (or Flite, which I’m just now looking into), maybe not so much as I’d have to run Chatscript as a server, right? (I’m in ubuntu linux) I’m starting to get way out of my depth here.

regards, Richard

 

 
  [ # 5 ]

The short answer is mainSystem.cpp has mainloop() where the io happens.

If python can call C++ code (which we know it can), then you could compile ChatScript to merely be subroutines, and call InitSystem(), InitStandalone(), and then call PerformChat for each input and do what you want with the output. E.g.,
http://stackoverflow.com/questions/145270/calling-c-c-from-python

 

 

 

 
  [ # 6 ]

and, yes, simply running chatscript as a server and talking to it is another answer

 

 
  login or register to react