Coders Packet

Speech based web searching using Python and Speech Recognition

By Vedant Keshav Jadhav

This is a simple speech-based web browser, using speech_recognition and pyttsx3 libraries in Python.

Speech processing and recognition is an emerging field in artificial intelligence and machine learning. A lot of modern technology is using speech-based techniques in every sector. Interacting bots, like Siri, Alexa and Google assistant use speech recognition as the base.


The main requirements for this project are-

1. speech_recognition

2. pyttsx3

These are mentioned in the requirements.txt file. To install the requirements, run the command pip3 install -r requirements.txt


Implementation details -

To run the program, run the command python3

Apart from the dependencies mentioned in the requirements, other dependencies used are:

a. os module

b. threading module


Here, threading is used to parallelly run two functions, namely "browser_search" and "speak_text". The "speak_text" is used to speak out what the user as said, and the "browser_search" function, as the name suggests, is used to browse the result on the web. The speech recognition part is run in the main function, inside an infinite loop.

The main program, when run, will take input from the user in the form of speech, and the output will be a web search on the default browser.

Example -

The speech input given was - "search for Open Sesame". The output is -

For the second time, the input was - "No", for which the output is - "Thank You! See ya again".

Some edge case keywords are-

1. "Bye", "Quit", and "Exit" to exit;

2. "No" or anything having synonymous, like "Nope", to terminate;

3. "Yes", to continue (not necessary to say);

4. Sentences starting with "search" or "search for", or not containing 1st and 2nd class of keywords will be searched on the web.


Download Complete Code


No comments yet