src/Assistant.py
def perform_action(command_action):
    """
    Process command and perform the corresponding action.
    This is the core decision-making process behind the Assistant.

    :param command_action: str
    :return: None
    """

    command_word, phrase = get_first_word_and_phrase_from(command_action)
    """
    Get first word and phrase. 
    'phrase' has had helper words removed and whitespace stripped.
    
    Run the determine_command_type function to check through the Settings to see if the command is in a list.
    """
    chosen_action = determine_command_type(command_word)

    if chosen_action == 'play':
        """
        Play using pywhatkit.playonyt()
        """

        logging.debug(f'Recognized {command_word} as Play; playing {phrase}')
        play_youtube_video_for(phrase)

    elif chosen_action == 'wiki':
        """
        Read Wikipedia using wikipedia.summary()
        Open web browser to Wikipedia website
        """
        logging.debug(f'Recognized {command_word} as Wiki; searching Wiki for {phrase}')

        open_wiki_results_for(phrase)

    elif chosen_action == 'search':
        """
        Search on Google using pywhatkit.search()
        """

        logging.debug(f'Recognized {command_word} as Search; searching Google for {phrase}')
        search_web_for(phrase)

    elif chosen_action == 'open':
        """
        Open various locations;
        currently limited to e-mail only based on url in Settings
        """

        logging.info(f'Recognized {command_word} as open; attempting to open {phrase[5:]}')
        open_page_or_file(phrase)

    else:
        """
        Catchall Option:
        When the first word is not recognized, Assistant goes here.
        Currently set to Google Search by default.
        """
        logging.info(f'Failed to recognize {command_word} (which is set to catchall by default); reverting to search')

        """
        Below is the catchall action to do when the command is not recognized.
        By default, it is set to search the web for the phrase.
        """
        do_catchall_action(phrase, command_word)

    Process command and perform the corresponding action.
    This is the core decision-making process behind the Assistant.

    :param command_action: str
    :return: None
    
Process command and perform the corresponding action.
This is the core decision-making process behind the Assistant.
Process command and perform the corresponding action . This is the core decision - making process behind the Assistant .
def perform_action(command_action):
    command_word, phrase = get_first_word_and_phrase_from(command_action)
    chosen_action = determine_command_type(command_word)
    if chosen_action == 'play':
        logging.debug(f'Recognized {command_word} as Play; playing {phrase}')
        play_youtube_video_for(phrase)
    elif chosen_action == 'wiki':
        logging.debug(f'Recognized {command_word} as Wiki; searching Wiki for {phrase}')
        open_wiki_results_for(phrase)
    elif chosen_action == 'search':
        logging.debug(f'Recognized {command_word} as Search; searching Google for {phrase}')
        search_web_for(phrase)
    elif chosen_action == 'open':
        logging.info(f'Recognized {command_word} as open; attempting to open {phrase[5:]}')
        open_page_or_file(phrase)
    else:
        logging.info(f'Failed to recognize {command_word} (which is set to catchall by default); reverting to search')
        do_catchall_action(phrase, command_word)
def perform_action ( command_action ) : command_word , phrase = get_first_word_and_phrase_from ( command_action ) """
    Get first word and phrase. 
    'phrase' has had helper words removed and whitespace stripped.
    
    Run the determine_command_type function to check through the Settings to see if the command is in a list.
    """ chosen_action = determine_command_type ( command_word ) if chosen_action == 'play' : """
        Play using pywhatkit.playonyt()
        """ logging . debug ( f'Recognized {command_word} as Play; playing {phrase}' ) play_youtube_video_for ( phrase ) elif chosen_action == 'wiki' : """
        Read Wikipedia using wikipedia.summary()
        Open web browser to Wikipedia website
        """ logging . debug ( f'Recognized {command_word} as Wiki; searching Wiki for {phrase}' ) open_wiki_results_for ( phrase ) elif chosen_action == 'search' : """
        Search on Google using pywhatkit.search()
        """ logging . debug ( f'Recognized {command_word} as Search; searching Google for {phrase}' ) search_web_for ( phrase ) elif chosen_action == 'open' : """
        Open various locations;
        currently limited to e-mail only based on url in Settings
        """ logging . info ( f'Recognized {command_word} as open; attempting to open {phrase[5:]}' ) open_page_or_file ( phrase ) else : """
        Catchall Option:
        When the first word is not recognized, Assistant goes here.
        Currently set to Google Search by default.
        """ logging . info ( f'Failed to recognize {command_word} (which is set to catchall by default); reverting to search' ) """
        Below is the catchall action to do when the command is not recognized.
        By default, it is set to search the web for the phrase.
        """ do_catchall_action ( phrase , command_word )
Process command and perform the corresponding action.
Process command and perform the corresponding action .
"""
    Process command and perform the corresponding action.
    This is the core decision-making process behind the Assistant.

    :param command_action: str
    :return: None
    """ """
    Get first word and phrase. 
    'phrase' has had helper words removed and whitespace stripped.
    
    Run the determine_command_type function to check through the Settings to see if the command is in a list.
    """ """
        Play using pywhatkit.playonyt()
        """ """
        Read Wikipedia using wikipedia.summary()
        Open web browser to Wikipedia website
        """ """
        Search on Google using pywhatkit.search()
        """ """
        Open various locations;
        currently limited to e-mail only based on url in Settings
        """ """
        Catchall Option:
        When the first word is not recognized, Assistant goes here.
        Currently set to Google Search by default.
        """ """
        Below is the catchall action to do when the command is not recognized.
        By default, it is set to search the web for the phrase.
        """
None
command_action
None