Speaking Dictionary Project in Python

Speaking Dictionary Project in Python

Speaking Dictionary is Python program that allows the user to find the meaning of English word by speaking it directly to the program(device). Then, the program(device) will directly explain the definition of the word out loud.

Speaking Dictionary Project Python

To Build a Speaking Dictionary You need to follow the below steps

Step 1. Download Python

You need Python to run this script. You can visit here to download Python and then you need to install packages named pyttsx3, PyDictionary.

pip install PyDictionary

pip install pyttsx3

Step 2. Write the following code

Write this code in a Python file or directly copy this code and save the file with the name and .py extension python SpeakingDictionary.py

import pyttsx3
from PyDictionary import PyDictionary

class Speaking:

def speak(self, audio):

# Having the initial constructor of pyttsx3
# and having the sapi5 in it as a parameter
engine = pyttsx3.init('sapi5')

# Calling the getter and setter of pyttsx3
voices = engine.getProperty('voices')

# Method for the speaking of the assistant
engine.setProperty('voice', voices[0].id)

class GFG:
def Dictionary(self):
speak = Speaking()
dic = PyDictionary()
speak.speak("Which word do u want to find the meaning sir")

# Taking the string input
query = str(input())
word = dic.meaning(query)

for state in word:
speak.speak("the meaning is" + str(word[state]))

if __name__ == '__main__':

Step 3. Run the code

After saving the code double-click on the file to run the program or simply open Command Prompt and write the following command.

python Speaking_Dictionary.py