예제 #1
0
def brain(name, speech_text):
    def check_message(check):
        """
        This function checks if the items in the list (specified 
        in the argument) are preset in the user's input  speech.
        """
        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()
    elif check_message(['how', 'i', 'look'] or ['how', 'am' 'i']):
        general_conversations.how_am_i()
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)
    elif check_message(['where', 'born']):
        general_conversations.where_born()
    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
    elif check_message(['what', 'time']):
        tell_time.what_is_time()
    else:
        general_conversations.undefined()
예제 #2
0
def brain(name, speech_text):
    def check_message(check):
        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()
    elif check_message(['how', 'i', 'look']) or check_message(
        ['how', 'am', 'i']):
        general_conversations.how_am_i()
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)
    elif check_message(['time']):
        tell_time.what_is_time()
    elif check_message(['where', 'born']):
        general_conversations.where_born()
    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
    else:
        general_conversations.undefined()
def brain(name, speech_text, music_path, city_name, city_code):
    def check_message(check):
        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False
        
    if check_message(['who','are','you' ]):
        general_conversations.who_are_you()
        
    elif check_message(['how','i','look' ]) or check_message(['how','am','i']):
        general_conversations.how_am_i()
    
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
        
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
        
    elif check_message(['party', 'time']) or check_message(['party', 'mix']):
        play_music.play_shuffle(music_path)
    
    elif check_message(['time']):
        tell_time.what_is_time()
        
    elif check_message(['weather']) or check_message(['hows', 'weather']):
        weather.weather(city_name, city_code)
        
    elif check_message(['define']):
        define_subject.define_subject(speech_text)
        
    elif check_message(['who','is']):
        who_is_this_person.who_is_this_person(speech_text)
        
    elif check_message(['headlines','news']):
        news_reader.news_reader()
        
    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()
        
    elif check_message(['sleep']):
        sleep.go_to_sleep()
        
    elif check_message(['play', 'music']) or check_message(['music']):
        play_music.play_random(music_path)
        
    elif check_message(['play']):
        play_music.play_specific_music(speech_text, music_path)
            
    else:
        general_conversations.undefined()
예제 #4
0
def brain(name, speech_text, city_name, city_code, proxy_username,
          proxy_password):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()

    elif check_message(['how', 'i', 'look']) or check_message(
        ['how', 'am', 'i']):
        general_conversations.how_am_i()

    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()

    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()

    elif check_message(['how', 'weather']) or check_message(
        ['hows', 'weather']):
        weather.weather(city_name, city_code)

    elif check_message(['business', 'news']):
        business_news_reader.news_reader()

    elif check_message(['define']):
        define_subject.define_subject(speech_text)

    elif check_message(['time']):
        tell_time.what_is_time()

    elif check_message(['connect', 'proxy']):
        connect_proxy.connect_to_proxy(proxy_username, proxy_password)

    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()

    elif check_message(['sleep']):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()
예제 #5
0
파일: brain.py 프로젝트: mfunesd/Melissa
def brain(name, speech_text, music_path, city_name, city_code):
    def check_message(check):
        """
        This function checks if the items in the list (specified in
        argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()
    elif check_message(['how', 'i', 'look']) or check_message(
        ['how', 'am', 'i']):
        general_conversations.how_am_i()
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)
    elif check_message(['where', 'did', 'you', 'born']):
        general_conversations.where_born()
    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
    elif check_message(['say', 'hello']):
        general_conversations.say_hello()
    elif check_message(['time']):
        tell_time.what_is_time()
    elif check_message(['how', 'weather']) or check_message(
        ['how', 'is', 'the', 'weather']):
        weather.weather(city_name, city_code)
    elif check_message(['wiki']):
        define_subject.define_subject(speech_text)
    elif check_message(['business', 'news']):
        business_news_reader.news_reader()
    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()
    elif check_message(['get', 'out']):
        sleep.go_to_sleep()
    elif check_message(['play', 'music']) or check_message(['music']):
        play_music.play_random(music_path)
    elif check_message(['play']):
        play_music.play_specific_music(speech_text, music_path)
    #if check_message(['como','estas']):
    #general_conversations.como_estas()
    #if check_message(['quien','eres']):
    #general_conversations.quien_eres()
    else:
        general_conversations.undefined(name)
예제 #6
0
파일: brain.py 프로젝트: sarenat/Melissa-AI
def brain(name, speech_text):
    def check_message(check):
        words_of_message = speech_text.split() # split speech_text into words and store it in
                                               # words_of_message, which is an array of words
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(["who", "are", "you"]):
        general_conversations.who_are_you()
    elif check_message(["how", "i", "look"]) or check_message(["how", "am", "i"] or check_message(["describe", "me"])):
        general_conversations.describe_me()
    elif check_message(["who", "am", "i"]):
        general_conversations.who_am_i(name)
    elif check_message(["how", "are", "you"]):
        general_conversations.how_are_you()
    elif check_message(["time"]):
        tell_time.what_is_time()
    elif check_message(["say", "goodbye", "melissa"]):
        goodbye.goodbye()
    else:
        general_conversations.undefined()
예제 #7
0
def brain(name, city_name, speech_text):
    def check_message(check):
        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    #must find a way to optimaze the menu
    if check_message(['who', 'are', 'you']) or check_message(['your', 'name']):
        general_conversations.who_are_you()
    elif check_message(['call', 'me']):
        name = name_change(speech_text)
        while (is_correct(speech_text, name) == False):
            name = name_change(speech_text)
    elif check_message(['where', 'born']):
        general_conversations.where_born(city_name)
    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
    elif check_message(['thank', 'you']):
        sleep.go_to_sleep(name)
    elif check_message(['time']):
        tell_time.what_is_time()
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message(['who', 'am', 'i']) or check_message(['my', 'name']):
        general_conversations.who_am_i(name)
    elif check_message(['repeat']):
        repeat.repeat_after(speech_text)
    elif check_message(['how', 'weather']) or check_message(
        ['hows', 'weather']):
        weather_t.weather(city_name)
    elif check_message(['define']):
        define_subject.define(speech_text)
    else:
        general_conversations.undefined()
예제 #8
0
def brain(name, speech_text, music_path, city_name, city_code, proxy_username, proxy_password):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who','are', 'you']):
        general_conversations.who_are_you()

    elif check_message(['how', 'i', 'look']) or check_message(['how', 'am', 'i']):
        general_conversations.how_am_i()

    elif check_message(['all', 'note']) or check_message(['all', 'notes']) or check_message(['notes']):
        notes.show_all_notes()

    elif check_message(['note']):
        notes.note_something(speech_text)

    elif check_message(['define']):
        define_subject.define_subject(speech_text)

    elif check_message(['time']):
        tell_time.what_is_time()

    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()

    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()

    elif check_message(['my', 'tweets']):
        twitter_pull.my_tweets()

    elif check_message(['play', 'music']) or check_message(['music']):
        play_music.play_random(music_path)

    elif check_message(['play']):
        play_music.play_specific_music(speech_text, music_path)

    elif check_message(['how', 'weather']) or check_message(['hows', 'weather']):
        weather.weather(city_name, city_code)

    elif check_message(['connect', 'proxy']):
        connect_proxy.connect_to_proxy(proxy_username, proxy_password)

    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()

    elif check_message(['sleep']):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()
def brain(name, speech_text, music_path, city_name, city_code, proxy_username,
          proxy_password):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()

    elif check_message(['how', 'i', 'look']) or check_message(
        ['how', 'am', 'i']):
        general_conversations.how_am_i()

    elif check_message(['all', 'note']) or check_message(
        ['all', 'notes']) or check_message(['notes']):
        notes.show_all_notes()

    elif check_message(['note']):
        notes.note_something(speech_text)

    elif check_message(['define']):
        define_subject.define_subject(speech_text)

    elif check_message(['time']):
        tell_time.what_is_time()

    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()

    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()

    elif check_message(['my', 'tweets']):
        twitter_pull.my_tweets()

    elif check_message(['play', 'music']) or check_message(['music']):
        play_music.play_random(music_path)

    elif check_message(['play']):
        play_music.play_specific_music(speech_text, music_path)

    elif check_message(['how', 'weather']) or check_message(
        ['hows', 'weather']):
        weather.weather(city_name, city_code)

    elif check_message(['connect', 'proxy']):
        connect_proxy.connect_to_proxy(proxy_username, proxy_password)

    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()

    elif check_message(['sleep']):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()
예제 #10
0
def brain(name, speech_text, music_path, city_name, city_zip, consumer_key,
          consumer_secret, access_token, access_token_secret, amigo_host_port):
    """
    Virtual Assistant's logic module or BRAIN.

    :param name:
    :param speech_text:
    :param music_path:
    :param city_name:
    :param city_zip:
    :param consumer_key:
    :param consumer_secret:
    :param access_token:
    :param access_token_secret:
    :return:
    """
    def check_message(check):
        """
        This function checks if the items in the list (specified in
        argument) are present in the user's input speech.
        :param check:
        :return:
        """
        words_of_message = speech_text.split()
        # change all words to lower text for case insensitive matching
        words_of_message[:] = [word.lower() for word in words_of_message]

        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    # TODO Externalize properties to config file
    wake_up_word = 'ria'
    riaId = 1

    if check_message([wake_up_word, 'who', 'are', 'you']) or check_message(
        [wake_up_word, "what's", 'your', 'name']):
        general_conversations.who_are_you()
    elif check_message([wake_up_word, 'how', 'i', 'look']) or check_message(
        [wake_up_word, 'how', 'am', 'i']):
        general_conversations.how_am_i()
    elif check_message([wake_up_word, 'tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message([wake_up_word, 'who', 'am', 'i']):
        general_conversations.who_am_i(name)
    elif check_message([wake_up_word, 'where', 'born']):
        general_conversations.where_born()
    elif check_message([wake_up_word, 'how', 'are', 'you']):
        general_conversations.how_are_you()
    elif check_message([wake_up_word, 'time']):
        tell_time.what_is_time()
    elif check_message([wake_up_word, 'how', 'weather']) or \
            check_message([wake_up_word, 'how\'s', 'weather']) or \
            check_message([wake_up_word, 'what', 'weather']):
        weather.weather(city_name, city_zip)
    elif check_message([wake_up_word, 'define']):
        define_subject.define_subject(speech_text)
    elif check_message([wake_up_word, 'news']):
        news_reader.news_reader()
    elif check_message([wake_up_word, 'open', 'firefox']):
        open_firefox.open_firefox()
    elif check_message([wake_up_word, 'play', 'music']) or check_message(
        ['music']):
        play_music.play_random(music_path)
    elif check_message([wake_up_word, 'play']):
        play_music.play_specific_music(speech_text, music_path)
    elif check_message([wake_up_word, 'party', 'time']) or check_message(
        ['party', 'mix']):
        play_music.play_shuffle(music_path)
    elif check_message([wake_up_word, 'note']):
        notes.note_something(speech_text)
    elif check_message([wake_up_word, 'all', 'notes']) or check_message(
        ['notes']):
        notes.show_all_notes()
    elif check_message([wake_up_word, 'tweet']):
        twitter_interaction.post_tweet(speech_text, consumer_key,
                                       consumer_secret, access_token,
                                       access_token_secret)
    elif check_message([wake_up_word, 'sleep']):
        sleep.go_to_sleep()
    elif check_message([wake_up_word, 'amigo']):
        amigo_bot_interaction.send_message(amigo_host_port, speech_text, riaId)
    else:
        general_conversations.undefined()
예제 #11
0
def brain(profile_data, speech_text):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()

    elif check_message(['tweet']):
        twitter_interaction.post_tweet(
            speech_text, profile_data['twitter']['consumer_key'],
            profile_data['twitter']['consumer_secret'],
            profile_data['twitter']['access_token'],
            profile_data['twitter']['access_token_secret'])

    elif check_message(['business', 'news']):
        business_news_reader.news_reader()

    elif check_message(['how', 'i', 'look']) \
      or check_message(['how', 'am', 'i']):
        general_conversations.how_am_i()

    elif check_message(['all', 'note']) \
      or check_message(['all', 'notes']) \
      or check_message(['notes']):
        notes.show_all_notes()

    elif check_message(['note']):
        notes.note_something(speech_text)

    elif check_message(['define']):
        define_subject.define_subject(speech_text)

    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()

    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(profile_data['name'])

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()

    elif check_message(['party', 'time']) \
      or check_message(['party', 'mix']):
        play_music.play_shuffle(profile_data['music_path'])

    elif check_message(['play', 'music']) \
      or check_message(['music']):
        play_music.play_random(profile_data['music_path'])

    elif check_message(['play']):
        play_music.play_specific_music(speech_text, profile_data['music_path'])

    elif check_message(['how', 'weather']) \
      or check_message(['hows', 'weather']):
        weather.weather(profile_data['city_name'], profile_data['city_code'])

    elif check_message(['time']):
        tell_time.what_is_time()

    elif check_message(['upload']):
        imgur_handler.image_uploader(speech_text,
                                     profile_data['imgur']['client_id'],
                                     profile_data['imgur']['client_secret'],
                                     profile_data['images_path'])

    elif check_message(['all', 'uploads']) \
      or check_message(['all', 'images']) \
      or check_message(['uploads']):
        imgur_handler.show_all_uploads()

    elif check_message(['feeling', 'angry']):
        lighting.feeling_angry()

    elif check_message(['feeling', 'creative']):
        lighting.feeling_creative()

    elif check_message(['feeling', 'lazy']):
        lighting.feeling_lazy()

    elif check_message(['dark']):
        lighting.very_dark()

    elif check_message(['lights', 'off']):
        lighting.turn_off()

    elif check_message(['sleep']):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()
예제 #12
0
def brain(profile_data, speech_text):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who','are', 'you']):
        general_conversations.who_are_you(profile_data)

    elif check_message(['tweet']):
        twitter_interaction.post_tweet(
            speech_text,
            profile_data['twitter']['consumer_key'],
            profile_data['twitter']['consumer_secret'],
            profile_data['twitter']['access_token'],
            profile_data['twitter']['access_token_secret'])

    elif check_message(['business', 'news']):
        business_news_reader.news_reader()

    elif check_message(['how', 'i', 'look']) \
      or check_message(['how', 'am', 'i']):
        general_conversations.how_am_i()

    elif check_message(['all', 'note']) \
      or check_message(['all', 'notes']) \
      or check_message(['notes']):
        notes.show_all_notes()

    elif check_message(['note']):
        notes.note_something(speech_text)

    elif check_message(['define']):
        define_subject.define_subject(speech_text)

    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()

    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(profile_data)

    elif check_message(['where', 'born']):
        general_conversations.where_born()

    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()

    elif check_message(['party', 'time']) \
      or check_message(['party', 'mix']):
        play_music.play_shuffle(profile_data['music_path'])

    elif check_message(['play', 'music']) \
      or check_message(['music']):
        play_music.play_random(profile_data['music_path'])

    elif check_message(['play']):
        play_music.play_specific_music(
            speech_text,
            profile_data['music_path'])

    elif check_message(['how', 'weather']) \
      or check_message(['hows', 'weather']):
        weather.weather(
            profile_data['city_name'],
            profile_data['city_code'])

    elif check_message(['time']):
        tell_time.what_is_time()

    elif check_message(['upload']):
        imgur_handler.image_uploader(
            speech_text,
            profile_data['imgur']['client_id'],
            profile_data['imgur']['client_secret'],
            profile_data['images_path'])

    elif check_message(['all', 'uploads']) \
      or check_message(['all', 'images']) \
      or check_message(['uploads']):
        imgur_handler.show_all_uploads()

    elif check_message(['feeling', 'angry']):
        lighting.feeling_angry()

    elif check_message(['feeling', 'creative']):
        lighting.feeling_creative()

    elif check_message(['feeling', 'lazy']):
        lighting.feeling_lazy()

    elif check_message(['dark']):
        lighting.very_dark()

    elif check_message(['lights', 'off']):
        lighting.turn_off()

    elif check_message(['sleep']):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()
예제 #13
0
def brain(name, speech_text,city_name, city_code, proxy_username, proxy_password):
    
    def check_message(check):
        """
        this function checks if the items in the list (specified in argument)
        are present in the user's input speech
        """
        words_of_message = speech_text.split()
        
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False
    
    # general conversation 
    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()
        
    elif check_message(['how', 'i', 'look']) or check_message(['how', 'am', 'i']):
        general_conversations.how_am_i()
    
    elif check_message(['tell', 'joke']):
        general_conversations.tell_joke()
        
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i(name)
    
    elif check_message(['where', 'born']):
        general_conversations.where_born()
        
    elif check_message(['how', 'are','you']):
        general_conversations.how_are_you()
    
    # check time
    elif check_message(['time']):
        tell_time.what_is_time()
        
    # check weather
    elif check_message(['how', 'weather']) or check_message(['hows', 'weather']):
        weather.weather(city_name, city_code)
    
    elif check_message(['define']):
        define_subject.define_subject(speech_text)
    
    # take notes
    elif check_message(['note']):
        notes.note_something(speech_text)

    # dictate all notes
    elif check_message(['all', 'notes','you']) or check_message(['notes']):
        notes.show_all_notes()
        
    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()
    
    elif check_message(['sleep']):
        sleep.go_to_sleep()



    else:
        general_conversations.undefine()
        
예제 #14
0
def brain(name, speech_text, music_path, city_name, city_code, proxy_username,
          proxy_password):
    def check_message(check):
        '''
        This function checks if the items in the list(specified in argument)
        are present in the user's input speech.
        '''
        words_of_message = speech_text.split()

        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(['who', 'are', 'you']):
        general_conversations.who_are_you()
    elif check_message(['how', 'i', 'look']) or check_message(
        ['how', 'am', 'i']):
        general_conversations.how_am_i()
    elif check_message(['joke']) or check_message(['tell', 'joke']):
        general_conversations.tell_joke()
    elif check_message(['who', 'am', 'i']):
        general_conversations.who_am_i()
    elif check_message(['how', 'are', 'you']):
        general_conversations.how_are_you()
    elif check_message(['time']):
        tell_time.what_is_time()
    elif check_message(['how', 'weather']) or check_message(
        ['hows', 'weather']):
        weather.weather(city_name, city_code)
    elif check_message(['define']):
        define_subject.define_subject(speech_text)
    elif check_message(['news']):
        bussiness_news_reader.news_reader()
    elif check_message(['open', 'firefox']):
        open_firefox.open_firefox()
    elif check_message(['google']):
        open_firefox.google_open(speech_text)
    elif check_message(['youtube']):
        open_firefox.youtube_open(speech_text)
    elif check_message(['sleep']):
        sleep.go_to_sleep()
    elif check_message(['play', 'music']) or check_message(['music']):
        play_music.play_random(music_path)
    elif check_message(['play']):
        play_music.play_specific_music(speech_text, music_path)
    elif check_message(['party', 'time']) or check_message(['party', 'mix']):
        play_music.play_shuffle(music_path)
    elif check_message(['faculty']):
        faculty.faculty_search(speech_text)
    elif check_message(['about', 'vit']):
        faculty.about_vit()
    elif check_message(['directions', 'electronics', 'department']):
        mapvit.etrx_block()
    elif check_message(['directions', 'biomedical', 'department']):
        mapvit.biom_block()
    elif check_message(['directions', 'library']):
        mapvit.library_block()
    elif check_message(['directions', 'vlounge', 'v', 'lounge']):
        mapvit.vlounge_block()

    else:
        open_firefox.search_net(speech_text)
예제 #15
0
def brain(
    name,
    speech_text,
    music_path,
    city_name,
    city_code,
    proxy_username,
    proxy_password,
    consumer_key,
    consumer_secret,
    access_token,
    access_token_secret,
    client_id,
    client_secret,
    images_path,
):
    def check_message(check):
        """
        This function checks if the items in the list (specified in argument) are present in the user's input speech.
        """

        words_of_message = speech_text.split()
        if set(check).issubset(set(words_of_message)):
            return True
        else:
            return False

    if check_message(["who", "are", "you"]):
        general_conversations.who_are_you()

    elif check_message(["tweet"]):
        twitter_interaction.post_tweet(speech_text, consumer_key, consumer_secret, access_token, access_token_secret)

    elif check_message(["business", "news"]):
        business_news_reader.news_reader()

    elif check_message(["how", "i", "look"]) or check_message(["how", "am", "i"]):
        general_conversations.how_am_i()

    elif check_message(["all", "note"]) or check_message(["all", "notes"]) or check_message(["notes"]):
        notes.show_all_notes()

    elif check_message(["note"]):
        notes.note_something(speech_text)

    elif check_message(["define"]):
        define_subject.define_subject(speech_text)

    elif check_message(["tell", "joke"]):
        general_conversations.tell_joke()

    elif check_message(["who", "am", "i"]):
        general_conversations.who_am_i(name)

    elif check_message(["where", "born"]):
        general_conversations.where_born()

    elif check_message(["how", "are", "you"]):
        general_conversations.how_are_you()

    elif check_message(["party", "time"]) or check_message(["party", "mix"]):
        play_music.play_shuffle(music_path)

    elif check_message(["play", "music"]) or check_message(["music"]):
        play_music.play_random(music_path)

    elif check_message(["play"]):
        play_music.play_specific_music(speech_text, music_path)

    elif check_message(["how", "weather"]) or check_message(["hows", "weather"]):
        weather.weather(city_name, city_code)

    elif check_message(["connect", "proxy"]):
        connect_proxy.connect_to_proxy(proxy_username, proxy_password)

    elif check_message(["open", "firefox"]):
        open_firefox.open_firefox()

    elif check_message(["time"]):
        tell_time.what_is_time()

    elif check_message(["upload"]):
        imgur_handler.image_uploader(speech_text, client_id, client_secret, images_path)

    elif check_message(["all", "uploads"]) or check_message(["all", "images"]) or check_message(["uploads"]):
        imgur_handler.show_all_uploads()

    elif check_message(["sleep"]):
        sleep.go_to_sleep()

    else:
        general_conversations.undefined()