An attempt to make a very simple, Personal Assistant that understands speech as well as text input and is capable of performing tasks other than conversing. This project is based on AIML 1.0 and uses pyaiml for using the AIML interpreter in python. AIML, is based on pattern matching and this project does not implement any sort of machine learning or language processing. Combined with a few python scripts, J.A.R.V.I.S now performs quite a few tasks:
-
Talk to J.A.R.V.I.S : hello
J.A.R.V.I.S : Well, helloTalk to J.A.R.V.I.S : Who is iron man?
J.A.R.V.I.S : Iron man is the one who created me.Talk to J.A.R.V.I.S : What does JARVIS stand for?
J.A.R.V.I.S : JARVIS stands for Just A Rather Very Intelligent SystemAll conversation is only for the hardcoded patterns, which are quite few. Can be easily extended to add AIML scripts of ALICE and other existing AIs.
-
Uses shell commands to play and pause rhythmbox music.
Talk to J.A.R.V.I.S : play music
J.A.R.V.I.S : On it!
Talk to J.A.R.V.I.S : play music
J.A.R.V.I.S : On it!
Talk to J.A.R.V.I.S : please open rhythmbox jarvis
J.A.R.V.I.S : Right away, sir! -
Talk to J.A.R.V.I.S : what time is it?
J.A.R.V.I.S : The time is 4 43 am -
Talk to J.A.R.V.I.S : how are you? / System report / System Status
J.A.R.V.I.S : I am fine, sir. All systems are at 100 percent. Battery percentage: 100%. Battery state: discharging. 265 processes are currently running. Current volume is 30 percent -
Talk to J.A.R.V.I.S : What is IIT, Bombay?
J.A.R.V.I.S : Do you want me to google that for you?
Talk to J.A.R.V.I.S : yes
J.A.R.V.I.S : Right away, sir! Created new window in existing browser session. -
Talk to J.A.R.V.I.S : play me a song
J.A.R.V.I.S : What song, sir?
Talk to J.A.R.V.I.S : Alter Bridge Isolation
J.A.R.V.I.S : On it! Created new window in existing browser session.Uses youtube.py script to find the first search result for the last user input in above case, and opens it in chromium browser.
-
Talk to J.A.R.V.I.S : Google what is the answer to life?
J.A.R.V.I.S : Right away, sir! Created new window in existing browser session.
Talk to J.A.R.V.I.S : Search youtube for Call of Duty
J.A.R.V.I.S : On it! Created new window in existing browser session.
Talk to J.A.R.V.I.S : Search for Navi Mumbai on google maps
J.A.R.V.I.S : On it! Created new window in existing browser session. -
Keep a set of wallpapers (and nothing else) in J.A.R.V.I.S/wallpapers directory. wallpaper.py randomly selects one and sets it as the desktop wallpaper by changing the key value using dconf-editor.
Talk to J.A.R.V.I.S : change wallpaper
J.A.R.V.I.S : On it! -
Talk to J.A.R.V.I.S : open nautilus
J.A.R.V.I.S : Right away, sir!
Talk to J.A.R.V.I.S : take me to /etc
J.A.R.V.I.S : Sure thing! (Opens /etc in nautilus)
Talk to J.A.R.V.I.S : take me home
J.A.R.V.I.S : Sure thing! (Opens ~ in nautilus)
Talk to J.A.R.V.I.S : open chromium / open firefox / open calculator / open vlc
J.A.R.V.I.S : Sure thing! -
Standard replies for unrecognized/unmatched inputs
Talk to J.A.R.V.I.S : you are dumb
J.A.R.V.I.S : I don't understand that yet. Maybe you could teach me.
Talk to J.A.R.V.I.S : no I won't
J.A.R.V.I.S : I don't know how to answer that. Maybe I could interest you in something else.Talk to J.A.R.V.I.S : go to sleep / exit / quit / bye / goodbye
closes the python script.
Make sure you install these packages before moving forward to other python libraries-
sudo apt install libasound-dev portaudio19-dev libportaudio2 libportaudiocpp0 ffmpeg libav-tools
You can run pip install -r requirements.txt
to install them all.
Individual packages listed as follows-
-
pip install aiml
-
pip install SpeechRecognition
-
pip install pyaudio
-
pip install pyalsaaudio
-
pip install pyttsx
-
-
pip install gTTS
-
pip install pygame
-
-
pip install argparse
Clone this repository. Change directories to go to that directory. Run the script "script.py" from the directory containing it. Run script as:
python script.py
: for text mode (default) of input
python script.py --voice
: for voice mode of input
python script.py --voice --gtts
: for voice mode of input, with Google Text to Speech enabled
Voice mode may give a series of warnings for numerous reasons, but still might fuction properly.
A lot can be done with this project. Core AI chatbot like functionality can be added. More python scripts can be associated. Pull requests for any such changes are accepted. Feel free to fork this project and make your own changes too.