how to make a virtual assistant with pycharm

ansh bhakuni
1 min readMay 22, 2021

--

in this I will tell you how to make a virtual assistant the can tell the summary of any word

but you need to install some module

  1. pip install pyttsx3
  2. pip install wikipedia
import wikipedia
import pyttsx3
engine = pyttsx3.init()
""" RATE """
rate = engine.getProperty('rate') # getting details of current speaking rate
print
(rate) # printing current voice rate
engine.setProperty('rate', 165) # setting up new voice rate
""" VOICE """
voices = engine.getProperty('voices')
name = input('enter your name: ')
try:
engine.say(f" hello {name} my name is jarvis Enter the word for which you want to find on Internet")
# Getting the query and printing and speaking
voices = engine.getProperty('voices')
get_input = input(" Enter the word for which you want to find on Internet: ")
summary = wikipedia.summary(get_input, sentences = 3)
print(summary)
engine.say(summary)
engine.runAndWait()
engine.stop()
except wikipedia.exceptions.PageError:
print("Sorry!! this search is not found")
engine.say("Sorry!! This page is not found.")
engine.runAndWait()
engine.stop()

--

--

ansh bhakuni
ansh bhakuni

No responses yet