Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (535)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  AI Assistant. Talk to your computer! BIG UPDATE, see details in thread.  (Read 2490 times)
0 Members and 1 Guest are viewing this topic.
Offline Slyth2727
« Posted 2013-10-25 00:34:57 »

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. 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

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:






Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Danny02
« Reply #1 - Posted 2013-10-25 00:41:48 »

before testing it out, may I ask for how long you usually wait for an answer?
Offline Slyth2727
« Reply #2 - Posted 2013-10-25 00:46:05 »

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

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #3 - Posted 2013-10-25 01:34:33 »

If this is in Python, it shouldn't be in the WIP section.
Offline Slyth2727
« Reply #4 - Posted 2013-10-25 02:07:16 »

WIP/tools/toy projects, correct?

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #5 - Posted 2013-10-25 02:10:38 »

And java-gaming.org. http://www.java-gaming.org/topics/wip-board-rules/27385/view.html
Offline Slyth2727
« Reply #6 - Posted 2013-10-25 02:12:36 »

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.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #7 - Posted 2013-10-25 02:19:00 »

No problem. Moved to misc
Offline Longarmx
« Reply #8 - Posted 2013-10-25 03:03:27 »

I get this error.
Quote
"CAIF.py", line 40
     print i,len(sentence), sentence
           ^
SyntaxError: invalid syntax

Except I can see this works perfectly in your screenshots.

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

Offline Slyth2727
« Reply #9 - Posted 2013-10-25 03:11:54 »

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

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Longarmx
« Reply #10 - Posted 2013-10-25 03:18:17 »

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

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

Offline Slyth2727
« Reply #11 - Posted 2013-10-25 03:32:08 »

Nuts. What version of python are you using?

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Sammidysam
« Reply #12 - Posted 2013-10-25 03:32:47 »

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.  Smiley
Offline Slyth2727
« Reply #13 - Posted 2013-10-25 03:42:18 »

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.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Danny02
« Reply #14 - Posted 2013-10-25 04:36:33 »

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?
Offline matheus23

JGO Kernel


Medals: 106
Projects: 3


You think about my Avatar right now!


« Reply #15 - Posted 2013-10-25 18:33:13 »

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 Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline Sammidysam
« Reply #16 - Posted 2013-10-25 18:44:35 »

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.
Offline Danny02
« Reply #17 - Posted 2013-10-25 22:19:59 »

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
Offline Slyth2727
« Reply #18 - Posted 2013-10-25 22:37:05 »

@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 Smiley
I will also change all the print statements to their py3 function versions which should make it compatible with all python versions.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 128
Projects: 4
Exp: 3 years



« Reply #19 - Posted 2013-10-25 22:39:03 »

Wouldn't big name companies put a cap on the number of requests per day? I know google does that...
Offline Slyth2727
« Reply #20 - Posted 2013-10-25 22:40:05 »

You also have to normally own a developers api key but I found at a little cheaty way to access their database through a demo page. Shhhhh.  persecutioncomplex
I thought it would still do it though as it did limit me if I accessed it on the actual page. It doesn't through code though which is interesting.

Was I before Chuang Tzu who dreamt about being a butterfly, or am I now a butterfly who dreams about being Chuang Tzu?
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Riven (7 views)
2014-07-29 12:53:52

Dwinin (7 views)
2014-07-29 10:59:34

E.R. Fleming (23 views)
2014-07-29 03:07:13

E.R. Fleming (9 views)
2014-07-29 03:06:25

pw (39 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (26 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21

Zero Volt (51 views)
2014-07-17 23:47:54
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!