Exemplo n.º 1
0
def greet():

    #fetch previous date
    previous_date = database.get_last_seen()

    #fetch today's date and store it to database
    today_date = get_date()
    database.update_last_seen(today_date)

    if previous_date == today_date:
        return ("welcome back sir")

    else:
        hour = int(get_hours())
        if hour >= 0 and hour < 12:
            return ("Good Morning! sir")

        elif hour >= 12 and hour < 18:
            return (" Good Afternoon! sir")

        else:
            return (" Good Evening! sir")
def greet():

    #fetch previous date
    previous_date = database.get_last_seen()

    #fetch today's date and store it to database
    today_date = get_date()
    database.update_last_seen(today_date)

    if previous_date == today_date:
        output("Welcome back sir")

    else:
        hour = int(get_hours())

        if hour >= 4 and hour < 12:
            output("Good Morning, sir ")

        elif hour >= 12 and hour < 16:
            output("Good After Noon, sir")

        else:
            output("goood evening , sir")
Exemplo n.º 3
0
def greet():

    #fetch todays date
    today_date = get_date()
    database.update_last_seen(today_date)

    #fetch previous date
    previous_date = database.get_last_seen()

    if previous_date == today_date:
        output("Welcome back ,Sir and i would be happy if Internet connection is available")

    else:

        hour = int(get_hours())

        if hour >= 4 and hour < 12 :
            output("Good Morning")

        elif hour>=12 and hour <16:
            output("Good Afternoon")

        else:
            output("Good Evening")
def process(query):

    if 'hi' in query :
        return "hello, Sir"
    elif 'hello' in query:
        return "Hi, Sir"
    elif "how are you" in query:
        return "I am fine sir, How are you doing?"
    elif "fine" in query:
        return "okay. What can i do for you sir."
    elif "thanks" in query:
        return "welcome, Sir"
    elif "thank you" in query:
        return "welcome, Sir"
    elif "sorry" in query:
        return "its ok, i never mind"
    elif "ok" in query:
        return "its nice to talk with you, Sir"
    elif "okay" in query:
        return "its nice to talk with you, Sir"
    elif "play music" in query:
        play_misic()
        return "playing music in youtube"
    elif "good morning" in query:
        return "Good Morning, Sir"
    elif "good evening" in query:
        return "Good evening, Sir"
    elif "good afternoon" in query:
        return "Good afternoon, Sir"
    elif "good night" in query:
        output("Good night, Sir")
        quit()
        #return "Good night, Sir"
    elif "open facebook" in query:
        open_facebook()
    elif "open my cv" in query:
        open_cv()
        return "opening your cv now"
    elif "open my google cv" in query:
        open_google_cv()
        return "opening your google cv now"
    elif "open my selling app" in query:
        open_my_selling_app()
        return "opening your selling app now in the browser"
    elif "open simon game" in query:
        open_simon_game()
        return "opening simon game in your browser"
    elif "open movie sentiment app" in query:
        open_my_movie_sentiment_app()
        return "opening movie sentiment app in your browser"
    elif "open movie recommender app" in query:
        open_my_movie_recommend_app()
        return "opening movie recommendation app in your browser"

    elif "search in wikipedia" in query:
        output("say what to search for in wikipedia")
        ans = take_input()
        ans.lower()
        answer = check_on_wiki(ans)
        if answer != "":
            return answer

    elif "search in internet" in query:
        output("say what to search for in internet")
        ans = take_input()
        ans.lower()
        answer = from_internet(ans)
        if answer != "":
            return answer

    elif "recommend me movies" in query:
        movie_recommendation()
        return "Sir, i hope you will like my recommendations."
    elif "recommend me movies again" in query:
        movie_recommendation()
        return "Sir, i hope you will like my recommendations."

    elif "open my github" in query:
        open_my_github()
        return "opening your github account sir"

    elif "open campusx page" in query:
        open_campusx()
        return "opening campusx official page in your browser"

    elif "open github" in query:
        open_github()
        return "opening github in browser"

    elif "activate price predictor module" in query:
        output("activating price predictor module")
        output("what do you want to sell?")
        output("options - mobile or bike or laptop/desktop or car or something else?")
        ans=take_command()
        if ans.lower()=="car":
            predict_car()
            return "I Hope the information would be helpful"
        elif ans.lower()=="mobile":
            predict_mobile()
            return "I Hope the information would be helpful"
        elif ans.lower()=="bike":
            predict_bike()
            return "I Hope the information would be helpful"
        elif ans.lower()=="laptop/desktop":
            predict_laptop()
            return "I Hope the information would be helpful"
        else:
            return (f"sorry, my maker is lazy hence i am still learning how to predict the price of {ans}")

    elif "activate price predictor module again" in query:
        output("activating price predictor module")
        output("what do you want to sell?")
        ans=take_command()
        if ans.lower()=="car":
            predict_car()
            return "I Hope the information would be helpful"
        elif ans.lower()=="mobile":
            predict_mobile()
            return "I Hope the information would be helpful"
        elif ans.lower()=="bike":
            predict_bike()
            return "I Hope the information would be helpful"
        elif ans.lower()=="laptop/desktop":
            predict_laptop()
            return "I Hope the information would be helpful"
        else:
            return (f"sorry, my maker is lazy hence i am still learning how to predict the price of {ans}")



    else:

        answer = get_answer_from_memory(query)

        if answer == "get time details" :
            return ("Time is "+ get_time())

        elif answer == 'quit':
            return ("Good-bye, Sir"+quit())

        elif answer== "check internet connection":
            if check_internet_connection():
                return "Internet is Connected"
            else:
                return "Internet is not Connected"

        elif answer == "tell date":
            return "Date is "+ get_date()

        elif answer == "on speak" :
            return turn_on_speech()

        elif answer == "off speak":
            return turn_off_speech()

        elif answer == "open facebook":
            open_facebook()
            return "opening facebook now"

        elif answer == "open google":
            open_google()
            return "opening google now"

        elif answer == "open browser":
            open_google()
            return "opening browser now"

        elif answer == "close browser":
            close_browser()
            return "Browser closed."

        elif answer == "change name":
            output("Okay! what do you want call me?")
            temp = take_command()
            if temp == assistant_details.name:
                return "Can't change. Its just my previous name"
            else:
                update_name(temp)
                assistant_details.name=temp
                return ("Now you can call me " + temp)

        else:

                return "Say that again please!"
def process(self,quest):

    answer = database.get_answers_from_memory(quest)
    
    if answer == "get time details":
        return(f'Time is {get_time()}')

    elif answer == "check internet connection":
        if internet.check_internet_connection():
            return "internet is connected"
        else:
            return "internet is not connected"
    
    elif answer == 'tell date':
        return ("date is "+get_date())

    elif answer == '100':
        return('I am fine, Thank you How are you, Sir')

    elif answer == '101':
        return("It's good to know that you are fine")

    elif answer == '102':
        return(f"my friend call me {assistant_details.name}")

    elif answer == "103":
        return("i have been created by KP KETAN KISHAN")

    elif answer == "104":
        return (pyjokes.get_joke())

    elif answer == "105":
        return ("if you talk then definately you are human")

    elif answer == "106":
        return("Thanks to KP. Further it is secret")

    elif answer == "107":
        return ("i am you virtual assistant created on 9th september")

    elif answer == "108":
        return ("i was created as a minor project by kumar priyanshu,ketan shah,kishan guta ")

    elif answer == "109":
        return (system_task.power_point())

    elif answer == "close powerpoint":
        return (system_task.close_powerpoint())

    elif answer == "110":
        speak("say your context")
        usertext = take_input(self)
        system_task.note(usertext)
        return("taken note of that")     
 
    elif answer == "close notepad":
        k=system_task.close_notepad()
        return(k)   

    elif answer == "111":
        return ("i'm not sure about, may be you should give me some time")

    elif answer == "112":
        return ("it's hard to understand")

    elif answer == "on speak":
        return database.turn_on_speech()

    elif answer == "off speak":
        return database.turn_off_speech()

    elif answer == 'music':
        system_task.play_music()
        return "playing song"

    elif answer == 'video':
        system_task.videos()
        return ("playing video")

    elif answer == 'focus':
        return (system_task.play_focus())

    elif answer == 'photo':
        system_task.photo()
        return ("opening photo")

    elif answer == 'chrome':
        return (system_task.chrome())

    elif answer == 'close chrome':
        return (system_task.close_chrome())

    elif answer == 'sublime text':
        return (system_task.sublime_text())

    elif answer == 'close sublime text':
        return (system_task.close_sublime_text())

    elif answer == 'vs code':
        return (system_task.vs_code())

    elif answer == 'close vs code':
        return (system_task.close_vs_code())

    elif answer == 'shell':
        return (system_task.shell())

    elif answer == 'word':
        return (system_task.word())

    elif answer == 'close word':
        return (system_task.close_word())

    elif answer == 'excel':
        return (system_task.excel())

    elif answer == 'close excel':
        return (system_task.close_excel())

    elif answer == "open facebook":
        open_facebook()
        return "opening facebook"

    elif answer == "close facebook":
        close_facebook()
        return "closing facebook"

    elif answer == "open google":
        open_google()
        return "opening google"

    elif answer == "open spotify":
        open_spotify()
        return "opening spotify"

    elif answer == "open geeksforgeeks":
        open_gfg()
        return "opening geeks for geeks"

    elif answer=="open youtube":
        open_youtube()
        return("opening youtube")

    elif answer=="open wynk":
        open_wynk()
        return "opening wynk"

    elif answer=="open stackof":
        open_stackof()
        return "opening stack over flow"

    elif answer=="open git":
        open_git()
        return "opening github"

    elif answer=="comsites":
        responded=open_comsites(self)
        return (f"opening {responded}")

    elif answer=="sites":
        responded=open_sites(self)
        return (f"opening {responded}")

    elif answer=="image search":
        responded=imgsearch(quest)
        return (f"opening {responded}")
    
    elif answer=="search":
        responded=search(quest)
        return (f"showing results for {responded}")

    elif answer=="play":
        responded=play(quest)
        return (f"playing... {responded}")

    elif answer=="whatsapp":
        return(open_whatsapp(self))

    elif answer == 'change name':
        give_output("okay! what do you want to call me")
        temp = take_input(self)
        if temp == assistant_details.name:
            return "can't change. i think you're happy with my old name"
        else:
            database.update_name(temp)
            assistant_details.name=temp
            return "now you can call me "+ temp
    
    elif answer == "0":
        return "say again"

    elif answer == "turn off":
        return "signing off sir"
    else:
        try:
            res = client.query(quest)
            if res['@success']=='true':
                pod1=res['pod'][1]
                result = pod1['subpod']['plaintext']
                if (('definition' in pod1['@title'].lower()) or ('result' in  pod1['@title'].lower()) or (pod1.get('@primary','false') == 'true')):
                    if result == '(data not available)':
                        answer = internet.check_on_wikipedia(quest+" wikipedia")
                        if answer!="":
                            return answer
                        else:
                            addq=adding_query(self,quest)
                            return addq
                    else:
                        return result
                else:
                    answer = internet.check_on_wikipedia(quest+" wikipedia")
                    if answer!="":
                        return answer
                    else:
                        addq=adding_query(self,quest)
                        return addq
            else:
                answer = internet.check_on_wikipedia(quest+" wikipedia")
                if answer!="":
                    return answer
                else:
                    addq=adding_query(self,quest)
                    return addq
        except Exception as e:
            return (e)
Exemplo n.º 6
0
def process(query):

    if 'hi' in query :
        return "hello, Sir"
    elif 'hello' in query:
        return "Hi, Sir"
    elif "how are you" in query:
        return "I am fine sir, How are you doing?"
    elif "fine" in query:
        return "okay. What can i do for you sir."
    elif "thanks" in query:
        return "welcome, Sir"
    elif "thank you" in query:
        return "welcome, Sir"
    elif "welcome" in query:
        return "hehe, Sir you are a nice person"
    elif "are you a girl" in query:
        return "what do you think, sir"
    elif "girl" in query:
        return "sir, you are very smart"
    elif "i think you are a girl" in query:
        return "i have no doubt, sir"
    elif "boy" in query:
        return "Sir, i am a girl"
    elif "i think you are a boy" in query:
        return "Nice joke sir, but it was not funny"
    elif "sorry" in query:
        return "its ok, i never mind"
    elif "who is your creator" in query:
        return "My creator is Lord Tuhin Mukherjee"
    elif "ok" in query:
        return "its nice to talk with you, Sir"
    elif "okay" in query:
        return "its nice to talk with you, Sir"
    elif "ok i got it" in query:
        return "its nice to talk with you, Sir"
    elif "okay i got it" in query:
        return "its nice to talk with you, Sir"

    else:

        answer = get_answer_from_memory(query)

        if answer == "get time details" :
            return ("Time is "+ get_time())

        elif answer == 'quit':
            return ("Good-bye, Sir"+quit())

        elif answer== "check internet connection":
            if check_internet_connection():
                return "Internet is Connected"
            else:
                return "Internet is not Connected"

        elif answer == "tell date":
            return "Date is "+ get_date()

        elif answer == "on speak" :
            return turn_on_speech()

        elif answer == "off speak":
            return turn_off_speech()

        elif answer == "open facebook":
            open_facebook()
            return "opening facebook now"

        elif answer == "open google":
            open_google()
            return "opening google now"

        elif answer == "open browser":
            open_google()
            return "opening browser now"

        elif answer == "close browser":
            close_browser()
            return "Browser closed."

        elif answer == "change name":
            output("Okay! what do you want call me?")
            temp = take_input()
            if temp == assistant_details.name:
                return "Can't change. Its just my previous name"
            else:
                update_name(temp)
                assistant_details.name=temp
                return ("Now you can call me " + temp)


        else:

            output("Don't know this one. Should i search in wikipedia or in Internet?")
            ans = take_input()
            ans.lower()
            if "wikipedia" in ans:
                answer = check_on_wiki(query)
                if answer != "":
                    return answer

            elif "internet" in ans :
                answer = from_internet(query)
                if answer != "":
                    return answer



            else:

                output("Can you please tell me what it means?")
                ans=take_input()
                if "it means" in ans:
                    ans = ans.replace("it means","")
                    ans=ans.strip()

                    value=get_answer_from_memory(ans)
                    if value=="":
                        return ("Can't help with this one")

                    else:
                        inset_question_and_answer(query, value)
                        return ("Thanks, I will remember it for the next time")

                else:

                    return "Can't help with this one!"
Exemplo n.º 7
0
def process(query):

    if 'play' in query and 'music' not in query:
        answer = get_answer_from_memory('play')
    else:
        answer = get_answer_from_memory(query)

    if answer == "get time details":
        return ("Time is " + get_time())

    elif answer == "check internet connection":
        if check_internet_connection():
            return "internet is connected"
        else:
            return "internet is not connected"

    elif answer == "tell date":
        return "Date is " + get_date()

    elif answer == "on speak":
        return turn_on_speech()

    elif answer == "off speak":
        return turn_off_speech()

    elif answer == "close browser":
        close_browser()
        return "closing browser"

    elif answer == "open facebook":
        open_facebook()
        return "opening facebook"

    elif answer == "open google":
        open_google()
        return "opening google"

    elif answer == "play music":
        return play_music()

    elif answer == 'play':
        return play_specific_song(query)

    elif answer == "pause music":
        return pause_music()

    elif answer == "stop music":
        return stop_music()

    elif answer == "next song":
        return next_song()

    elif answer == "previous song":
        return previous_song()

    elif answer == 'change wallpaper':
        return change_wallpaper()

    elif answer == 'get news':
        return get_news()

    elif answer == 'change name':
        output("Okay! what do you want to call me")
        temp = take_input()
        if temp == assistant_details.name:
            return "Can't change. I think you're happy with my old name"
        else:
            update_name(temp)
            assistant_details.name = temp
            return "Now you can call me " + temp

    else:
        output("Dont know this one should i search on internet?")
        ans = take_input()
        if "yes" in ans:
            answer = check_on_wikipedia(query)
            if answer != "":
                return answer

        else:
            output("can you please tell me what it means?")
            ans = take_input()
            if "it means" in ans:
                ans = ans.replace("it means", "")
                ans = ans.strip()

                value = get_answer_from_memory(ans)
                if value == "":
                    return "Can't help with this one "

                else:
                    insert_question_and_answer(query, value)
                    return "Thanks i will remember it for the next time"

            else:
                return "can't help with this one"