Open In App
Related Articles

Speak the meaning of the word using Python

Improve Article
Save Article
Like Article

The following article shows how by the use of two modules named, pyttsx3 and PyDictionary, we can make our system say out the meaning of the word given as input. It is module which speak the meaning when we want to have the meaning of the particular word.

Modules needed

  • PyDictionary: It is a Dictionary Module for Python 2-3 to get meanings, translations, synonyms and Antonyms of words. It uses WordNet for doing as its functionality suggests and has dependencies on modules named Requests, BeautifulSoup4 and goslate .
  • pyttsx3: It is a text to speech library. This module is what gives our system voice so that they can communicate with us. Pyttsx3 uses sapi5 in windows and espeak in windows.

Both modules can be installed by using pip in the following way:

pip install PyDictionary
pip install pyttsx3  


As mentioned above, by the combination of two modules we will generate the functionality required and to do that the following steps were taken:

  • A method is defined to make the system search for the meaning of the word provided as input
  • Another method is defined to make the system say out loud the output generated corresponding to the input provided.
  • The output returned in this may be a dictionary, so we have to extract each meaning of the word provided as it will be in a key-value format.

Below is the Implementation.


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__':


Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!

Last Updated : 28 Jun, 2022
Like Article
Save Article
Similar Reads
Complete Tutorials