Пример #1
0
def search_data(data):
    if data:
        if "hi" in data or "hello" in data:
            speak("hi how can i help you")
        elif ('time now') in data or ('time please') in data or (
                'tell me the time') in data:
            speak("now time is: " + ctime())
        elif "your name" in data:
            speak("I am a robot")
        elif "dead" in data:
            speak("no, i am just a machine")
        elif "start training" in data or "train yourself" in data:
            tr.training_start()
        elif "open browser" in data:
            wb.open_new_tab('http://www.google.com')
        elif "close browser" in data:
            os.system("taskkill /F /IM chrome.exe")
        elif "open calculator" in data:
            os.system('calc.exe')
        elif "close calculator" in data:
            os.system("taskkill /F /IM calculator.exe")
        elif "open facebook" in data:
            wb.open_new_tab('https://www.facebook.com/')
        else:
            find.find_text(data)
Пример #2
0
def search_data(data):
    if data:
        if "hi" in data or "hello" in data:
            speak("hi how can i help you")
        elif ('time now') in data or ('time') in data or ('the time') in data:
            speak("now time is" + ctime())
        elif "your name" in data:
            speak("My owner calls me billy!!!")
        elif "dead" in data:
            speak("no, i am just a machine")
        elif "open google" in data:
            url = 'https://www.google.com/'
            chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
            webbrowser.get(chrome_path).open(url)
        elif "search " in data or "tell me " in data:
            query = data.replace("search ", "")
            query = data.replace("tell me about ", "")
            url = "https://www.google.com.tr/search?q={}".format(query)
            webbrowser.open(url)
        elif "start training" in data or "training" in data or "train" in data:
            tr.training_start()
        elif "remember" in data or "can you remember" in data:
            speak("yes. what do you want me to rembember for you.")
            q = recordAudio()
            ##            q = "what is " + q
            speak(q)
            a = recordAudio()
            ##            a = a.replace("my ", "your ")
            remember(q, a)
        elif "go now" in data or "bye" in data or "good bye" in data or "quit" in data:
            quit()
        else:
            find.find_text(data)
Пример #3
0
def search_data():
    jsonData = request.get_json()
    data = jsonData['id']
    if data:
        if "hi" in data or "hello" in data or "hey" in data:
            #speak("hi what can i do for you")
            # return statement is used for JSON here
            return "hi what can i do for you"

        elif 'time now' in data or 'time please' in data or 'tell me the time' in data:
            return "now time is" + ctime()
            #speak("now time is" + ctime())

        elif "your name" in data:
            return "I am a robot"
            #speak("I am a robot")

        elif "dead" in data:
            return "no, i am just a machine"
            #speak("no, i am just a machine")

        elif "bye" in data:

            return "bye! have a nice day! See you soon"
            exit()
            #speak("bye! have a nice day! See you soon")

        elif "weather report" in data:
            #speak("Opening weather news")
            wb.open(
                "https://www.google.com/search?ei=O5OjXKmKKMb39QPUkL-wCg&q=weather+today+in+jabalpur&oq=weather+today+in+jab&gs_l=psy-ab.1.0.0i70i256j0l3j0i22i30l3j0i22i10i30j0i22i30l2.27940.40180..42499...0.0..0.423.3545.0j4j10j0j1......0....1..gws-wiz.......0i71j35i39i285i70i256j35i39j0i131i67j0i67j0i131j0i20i263.HQpagm5Pgg8",
                new=0,
                autoraise=True)
            return "opening weather news"
            #speak("i am ready to take new command")

        elif 'open Reddit python' in data:
            #speak("open Reddit python")
            wb.open("http://www.reddit.com/r/python", new=0, autoraise=True)
            return "open Reddit python"
            #speak("i am ready to take new command")

        elif "start training" in data or "train yourself" in data:
            tr.training_start()

        elif "news" in data:
            return 'In which format do you like to see news! <INPUT type="sub" value="Text" onclick="callNewsApi(\'text\')"> or <INPUT type="sub" value="Video" onclick="callNewsApi(\'video\')">'

        elif 'what\'s up' in data:
            return 'Chilling bro'
            #speak('C3hilling bro')

        else:
            find.find_text(data)
Пример #4
0
def search_data(data):
    if data:
        if "bye" in data or "exit" in data or "f**k off" in data:
            speak("Good bye")
            exit()
        elif "hi" in data or "hello" in data or "hey" in data or "hey Dexter" in data:
            speak("Hi, how can I help you ?")
        elif "help" in data:
            speak("Try one of the following:")
            speak("Say: ")
            speak("hello to get response,")
            speak("open youtube, open whatsapp")
            speak("search google")
            speak("Calculate 2+2")
            speak("how is the weather outside")
            speak("introduce yourself")
            speak("Tell me a joke")
            speak("Tell me some interesting facts")
        elif "how's the Josh" in data or "how is the Josh" in data:
            speak("High Sir!")
        elif "time now" in data or "time please" in data or "tell me the time" in data:
            speak("now the time is " + ctime())
        elif "your name" in data:
            speak("My name is Dexter 1.0")
        elif "joke" in data or "Joke" in data:
            speak("Yup! One of the interesting jokes I remember is ")
            joke.telljoke()
        elif "fact" in data or "Fact" in data:
            speak("One of the interesting facts I remember is ")
            facts.tellFact()
        elif "How old are you" in data or "your age" in data:
            speak(
                "I don't remember the exact day I born, but I can say I'm way younger than you"
            )
        elif "about yourself" in data or "introduction" in data or "introduce yourself" in data:
            speak(
                "Hello, My name is Dexter 1.0. I'm your personal assistant. I was created as a minor project. "
                "My skills are: I can open YouTube for you, tell you the current time, open some of the apps "
                "installed on this pc, do arithmetic calculations, get you updated on the current activities "
                "running across the world.")
            speak(
                "And most importantly, I give my best when it comes to entertain you."
            )
            speak("My best part is, 'I never stop learning!'")
        elif "weather" in data:
            speak("let's see what google says about current weather")
            wb.open("http://www.google.com/search?client=firefox-b-d&q=" +
                    data)
        # open commands...

        elif "open" in data and "YouTube" in data:
            if input_mode:
                speak("opening YouTube")
                wb.open("https://www.youtube.com", autoraise=True)
            else:
                speak("Sorry! This can not be done in offline mode")
        elif "open Facebook" in data:
            if input_mode:
                speak("opening facebook")
                wb.open("https://www.facebook.com", autoraise=True)
            else:
                speak("Sorry! This can not be done in offline mode")
        elif "open WhatsApp" in data:
            if input_mode:
                speak("opening whatsapp")
                wb.open("https://web.whatsapp.com/", new=0, autoraise=True)
            else:
                speak("Sorry! This can not be done in offline mode")
        elif "mail" in data:
            speak("opening mail")
            os.system("start outlookmail:")
        elif "YouTube" in data:
            if input_mode == 1:
                speak("what to search")
                query = recordAudio()
                speak("opening youtube")
                wb.open("https://www.youtube.com/results?search_query=" +
                        query,
                        new=0,
                        autoraise=True)
            elif input_mode == 2:
                speak("what to search")
                query = input()
                speak("opening youtube")
                wb.open("https://www.youtube.com/results?search_query=" +
                        query,
                        new=0,
                        autoraise=True)
            else:
                speak("Sorry! This can not be done in offline mode")
        elif "your significance" in data:
            speak(
                "ghar say mai nikla. tanha akela? saath me mere kaun hai. BOT hai mera?"
            )
        elif "Google" in data:
            if input_mode == 1:
                speak(" what to search")
                term = recordAudio()
                wb.open("http://www.google.com/search?client=firefox-b-d&q=" +
                        term,
                        autoraise=True)
                speak("Here is what I found on Google")
            elif input_mode == 2:
                speak("what to search")
                term = input()
                wb.open("http://www.google.com/search?client=firefox-b-d&q=" +
                        term,
                        autoraise=True)
                speak("Here is what I found on Google")
            else:
                speak("Sorry! This can not be done in offline mode")

        # calculate commands...

        elif "calculate" in data:
            problem = data[10:]
            result = str(eval(problem))
            speak(result)

        elif "let's play" in data or "open" in data:
            if "Counter Strike" in data:
                os.startfile(
                    "C:\Program Files (x86)\Condition Zero - Xtreme Edition\czero.exe"
                )
                speak("opening counter strike")
        elif "close" in data or "kill" in data:
            if "Counter Strike" in data:
                os.system("TASKKILL /F /IM czero.exe")
                speak("Counter Strike closed!")
            elif "music" in data:
                os.system("TASKKILL /F /IM mswindowsmusic:")
        elif "play" in data:
            if "music" in data:
                speak("opening groove music")
                os.system("start mswindowsmusic:")
        elif "check news" in data:
            if input_mode == 1 or input_mode == 2:
                speak("fetching latest news for you!")
                wb.open("https://m.dailyhunt.in/news/india/english/")
            else:
                speak("Sorry! This can not be done in offline mode")
        elif "train yourself" in data or "start training" in data:
            tr.training_start()
        else:
            find.find_text(data)