├── LICENSE ├── desktopassitant.py ├── emailassistant.py ├── music and newsAI.py ├── virassitant.py └── voice translator.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 AKpython 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /desktopassitant.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import datetime 3 | import subprocess 4 | import pywhatkit 5 | import pyttsx3 6 | import webbrowser 7 | 8 | engine=pyttsx3.init() 9 | voices=engine.getProperty('voices') 10 | engine.setProperty('voice',voices[1].id) 11 | recognizer=sr.Recognizer() 12 | 13 | def cmd(): 14 | with sr.Microphone() as source: 15 | print("Clearing background noises...Pleasw wait") 16 | recognizer.adjust_for_ambient_noise(source,duration=0.5) 17 | print('Ask me anything..') 18 | recordedaudio=recognizer.listen(source) 19 | try: 20 | text=recognizer.recognize_google(recordedaudio,language='en_US') 21 | text=text.lower() 22 | print('Your message:',format(text)) 23 | 24 | except Exception as ex: 25 | print(ex) 26 | if 'chrome'in text: 27 | a='Opening chrome..' 28 | engine.say(a) 29 | engine.runAndWait() 30 | programName = "C:\Program Files\Google\Chrome\Application\chrome.exe" 31 | subprocess.Popen([programName]) 32 | if 'time' in text: 33 | time = datetime.datetime.now().strftime('%I:%M %p') 34 | print(time) 35 | engine.say(time) 36 | engine.runAndWait() 37 | if 'play' in text: 38 | a='opening youtube..' 39 | engine.say(a) 40 | engine.runAndWait() 41 | pywhatkit.playonyt(text) 42 | if 'youtube' in text: 43 | b='opening youtube' 44 | engine.say(b) 45 | engine.runAndWait() 46 | webbrowser.open('www.youtube.com') 47 | while True: 48 | cmd() 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /emailassistant.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import yagmail 3 | 4 | recognizer=sr.Recognizer() 5 | with sr.Microphone() as source: 6 | print('Clearing background noise..') 7 | recognizer.adjust_for_ambient_noise(source,duration=1) 8 | print("waiting for your message...") 9 | recordedaudio=recognizer.listen(source) 10 | print('Done recording..!') 11 | try: 12 | print('Printing the message..') 13 | text=recognizer.recognize_google(recordedaudio,language='en-US') 14 | 15 | print('Your message:{}'.format(text)) 16 | 17 | except Exception as ex: 18 | print(ex) 19 | 20 | #Automate mails: 21 | 22 | reciever=' Receiver's email id' 23 | message=text 24 | sender=yagmail.SMTP('Sender's email id ') 25 | sender.send(to=reciever,subject='This is an automated mail',contents=message) -------------------------------------------------------------------------------- /music and newsAI.py: -------------------------------------------------------------------------------- 1 | #Modules required 2 | 3 | import speech_recognition as sr 4 | from GoogleNews import GoogleNews 5 | import pyttsx3 6 | 7 | #Intialization 8 | googlenews = GoogleNews() 9 | engine=pyttsx3.init() 10 | voices=engine.getProperty('voices') 11 | engine.setProperty('voice',voices[1].id) 12 | recognizer=sr.Recognizer() 13 | 14 | #Commands 15 | def cmd(): 16 | with sr.Microphone() as source: 17 | print("Clearing background noises...Please wait") 18 | recognizer.adjust_for_ambient_noise(source,duration=0.5) 19 | print('Ask me anything..') 20 | recordedaudio=recognizer.listen(source,timeout=1) 21 | print("Done recording..!") 22 | try: 23 | text=recognizer.recognize_google(recordedaudio,language='en_US') 24 | text=text.lower() 25 | print('Your message:',format(text)) 26 | 27 | except Exception as ex: 28 | print(ex) 29 | 30 | if 'headlines' in text: 31 | engine.say('Getting news for you ') 32 | engine.runAndWait() 33 | googlenews.get_news('Today news') 34 | googlenews.result() 35 | a=googlenews.gettext() 36 | print(*a[1:5],sep=',') 37 | 38 | if 'tech' in text: 39 | engine.say('Getting news for you ') 40 | engine.runAndWait() 41 | googlenews.get_news('Tech') 42 | googlenews.result() 43 | a=googlenews.gettext() 44 | print(*a[1:5],sep=',') 45 | 46 | if 'politics' in text: 47 | engine.say('Getting news for you ') 48 | engine.runAndWait() 49 | googlenews.get_news('Politics') 50 | googlenews.result() 51 | a=googlenews.gettext() 52 | print(*a[1:5],sep=',') 53 | 54 | if 'sports' in text: 55 | engine.say('Getting news for you ') 56 | engine.runAndWait() 57 | googlenews.get_news('Sports') 58 | googlenews.result() 59 | a=googlenews.gettext() 60 | print(*a[1:5],sep=',') 61 | 62 | if 'cricket' in text: 63 | engine.say('Getting news for you ') 64 | engine.runAndWait() 65 | googlenews.get_news('cricket') 66 | googlenews.result() 67 | a=googlenews.gettext() 68 | print(*a[1:5],sep=',') 69 | cmd() -------------------------------------------------------------------------------- /virassitant.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | import wikipedia 3 | import pyttsx3 4 | 5 | engine=pyttsx3.init() 6 | recognizer=sr.Recognizer() 7 | with sr.Microphone() as source: 8 | print('Clearing background noise...Please wait') 9 | recognizer.adjust_for_ambient_noise(source,duration=1) 10 | print("waiting for your message...") 11 | recordedaudio=recognizer.listen(source) 12 | print('Done recording') 13 | 14 | try: 15 | print('Printing your message...Please wait') 16 | text=recognizer.recognize_google(recordedaudio,language='en-US') 17 | print('Your Message:{}',format(text)) 18 | 19 | except Exception as ex: 20 | print(ex) 21 | 22 | #Input data 23 | wikisearch=wikipedia.summary(text) 24 | engine.say(wikisearch) 25 | engine.runAndWait() -------------------------------------------------------------------------------- /voice translator.py: -------------------------------------------------------------------------------- 1 | import speech_recognition as sr 2 | from google_trans_new import google_translator 3 | import pyttsx3 4 | recognizer=sr.Recognizer() 5 | engine = pyttsx3.init() 6 | with sr.Microphone() as source: 7 | print('Clearing background noise...') 8 | recognizer.adjust_for_ambient_noise(source,duration=1) 9 | print('Waiting for message..') 10 | audio = recognizer.listen(source,timeout=1) 11 | print('Done recording..') 12 | try: 13 | print('Recognizing..') 14 | result = recognizer.recognize_google(audio,language='ta-IN') 15 | except Exception as ex: 16 | print(ex) 17 | def trans(): 18 | langinput=input('Type the language you want to convert:') 19 | translator = google_translator() 20 | translate_text = translator.translate(str(result),lang_tgt=str(langinput)) 21 | print(translate_text) 22 | engine.say(str(translate_text)) 23 | engine.runAndWait() 24 | trans() 25 | 26 | --------------------------------------------------------------------------------