AI Assistant. Talk to your computer! BIG UPDATE, see details in thread.

Guys I did it. I actually DID IT. After two weeks of learning Python continually I got a fully working Jarvis clone/Siri clone that uses 2 of the major AI knowledge databases as well as 1 conversation AI. Once I start the program it listens for me to talk and once I do it waits until I am finished talking, waits 3 seconds to see if I need to add something and then converts the .mp3 to a .flac. Once it does that it then sends it to http://www.google.com/speech-api/v1/recognize?lang=en_EN with the contents of the .flac as POST. Then once it receives the string back it, depending on whether or not it’s on conversation mode, sends it either to Evi(Question mode) or Cleverbot(Conversation mode). If Evi doesn’t know (returns an error) then it sends it to Wolfram|Alpha. If that one doesn’t even know then it sends it to Cleverbot to get a really sarcastic answer. Then it sends the answer string to http://translate.google.com/translate_tts, which returns an mp3. Then, obviously, it plays that! Once I get an Arduino I’m going to hook JAIK (Jake is what I call it) to my TV, room light, and radio for the ultimate Jarvis clone! This was just a thing to get used to Python and I used multiple modules and the code is extraordinarily messy so don’t kill me. Also, it’s currently set up for Linux with cvlc for playing media. [s]Here’s a list of the modules if your really, really want to run it:

  • wolframalpha
  • wave (might be built in, I forget)
  • pyttsx
  • pyaudio
  • cleverbot (included in the file so you don’t need to download it)
  • pycurl
    [/s]
    UPDATE:
  • You no longer need to download the modules, they are all packaged in the main project.
  • Fixed a bug which caused Wolfram|Alpha not to work.
  • Big bandwidth killer removed.
  • Python 3 Compatible!

Here’s the download:

Download here!

To start the program run ‘python CAIF.py’

Tips:

  • Say a sentence with ‘exit’ or ‘quit’ will quit the program.
  • Run a program by saying ‘run “program_name”’. Keep in mind that the Speech to Text won’t translate periods and lots of other things so this is pretty much useless for arguments and stuff, but whatever.

And here’s some pictures:

before testing it out, may I ask for how long you usually wait for an answer?

About 3-6 seconds. Depends on your internet really. I have bad internet and it takes about that long.

If this is in Python, it shouldn’t be in the WIP section.

WIP/tools/toy projects, correct?

And java-gaming.org. http://www.java-gaming.org/topics/wip-board-rules/27385/view.html

I’m sorry. I worked pretty hard on this, I just wanted to show it to you guys…
Any mods can take this down if they would like.

No problem. Moved to misc

I get this error.

Except I can see this works perfectly in your screenshots.

Edit:
I’m using Windows 7, Python 3.3 (64-bit)

Hm. Line 40, lemme check it out.
Oh yes. Replace the period with a comma :slight_smile:

Oh sorry, my mistake. That is a comma. I accidentally in put a period. :stuck_out_tongue:

Nuts. What version of python are you using?

You wrote this for Python 2.7.5 I assume, and you need parentheses around print calls starting with Python 3. In Python 3, they changed print from being a magical thing with special syntax (no parentheses needed) to being a function like everything else. If you ran it with python and python -V returns 2.7.5, you may want to make some changes for it to run with Python 3. It is your choice, however. Users with Python 3 cannot run it right now. Linux still defaults Python version to Python 2.7.5 because Python 3 is not backward compatible and adjusting all of the code takes a very long time.

Just the things you get to have fun with using Python. :slight_smile:

Yeah I read about that somewhere, thanks for reminding me! I have to get schoolwork done and it’s late, so I’ll do that and post it on Friday. Thanks again.

I have python 2.7.3 installed on my linux machine and don’t know anything about Python. Is there a way for you to package all the modules or the app in a way which is easy to just run?

Same for me, I really want to try this out, though :slight_smile:

If you are on Linux, you can hopefully just use python3 from the command-line or just install Python 3 and then you will have access to the python3 command. From there, just run it with that command instead of python and you are good to go.

Ideally, the script would have a shebang at the top (for example, #! python3) which would allow you to simply run ./script.py and it would handle which Python interpreter was necessary (2.7.5 vs. 3.3.2) for you. It would take the command after the first two characters of the shebang and use that interpreter, i.e. turning ./script.py into python3 script.py when launched.

You shouldn’t expect Linux not to have support for Python 3. It just isn’t the default interpreter for Python. You just simply add a ‘3’ to the end of your call.

EDIT: Hmm, I am not sure why I went into so much detail about Python 3. I guess the main point was that shebangs make it easier to run Python code.

mm, after spending some time in all different kinds of package managers I got your app to run, but was disappointed. There is probably something going wrong, I see “jack server is not running or cannot be started” all the time in the console.

I can ask something, but I get instantly the answer that he doesn’t know and is sending the question to wolfram after that he just says I don’t know the answer and quits

@Danny02,
Yes it does always print out that the jack server isn’t running or cannot be started. That’s just a warning and the program will still work. Remember that it is just accessing the Evi Desktop online database, not the mobile one which is much ‘smarter’ and I am trying to figure out how to access it. The program is also is very “I don’t know” prone right now.

@matheus23 and @Danny02,
Of course, I can certainly get all the modules packaged into the zip! I’ll work on that right now and hopefully have it up in about 10-30 mins :slight_smile:
I will also change all the print statements to their py3 function versions which should make it compatible with all python versions.

Wouldn’t big name companies put a cap on the number of requests per day? I know google does that…