Python3 (Make your own Jarvis !)

Welcome to CCP
Lets get started !

Now,
Time has come to make something cool with the coolest language!

So,
Straight to work,
There are 2 main modules you will be mainly working with and these all packages will be available at our friendly website: pypi.org,
So what are these packages ?

1. speech recognition (converts speech-to-text online)
command -> python3 -m pip install speechrecognition (32.8 Mb)

2. pyttsx3 (converts text-to-speech offline)
command -> python3 -m pip install pyttsx3 (Unknown)

So,
These were the packages,
After installing them,

Make some basic setup like this:
pyttsx3 setup and check:


speech recognition setup to listen:



The speech recognition requires an active and somewhat fast internet connection to send the voice data to google and download the text sent from google,

If you are an intermediate, you have to use the library to recognise your voice as building of the API's like that of google which downloads our voice data and sends text output requires you to learn Machine learning and you should have plenty knowledge of neural networks to build a speech recognition engine offline,

But for now,
we will not reinvent the wheel and use the pre-existing ones,

Now lets see a working example of a voice assistant:


If you have covered till here, then Congratulations for making your first speaking program that also listens for you !

Hah !, but these are only functions and you have to think to how to implement these in your program,

It for now contains only 2 cases of "hello" and "who are you" questions, but you can add infinitely many cases if you can,
The more cases there are its likely that your program seems perform more smart,

Pro tip: sometimes you can feel that some questions have priority in their own thus, you can move them up and above than some less priority questions and queries,

Example:

for example you have an elif statement for "hi jarvis" over another elif statement "what is the time",
Then, if you speak "Hi jarvis what is the time",
then it will say "Hello sir" and will not tell the time and i bet you won't want your program to behave like this,

To resolve this issue,
You should place the "what is the time" elif statement over "Hi jarvis",

This will run the time query first and you will get to know the time

So, you can also make one have fun with it by adding more and more to this,

Catch you later !

Comments