def trigger_keyphrases(
    text                          = None,  # input text to parse
    keyphrases                    = None,  # keyphrases for parsing input text
    response                      = None,  # optional text response on trigger
    function                      = None,  # optional function on trigger
    kwargs                        = None,  # optional function keyword arguments
    confirm                       = False, # optional return of confirmation
    confirmation_prompt           = "Do you want to continue? (y/n)",
    confirmation_feedback_confirm = "confirm",
    confirmation_feedback_deny    = "deny"
    ):
    """
    Parse input text for keyphrases. If any keyphrases are found, respond with
    text or by seeking confirmation or by engaging a function with optional
    keyword arguments. Return text or True if triggered and return False if not
    triggered. If confirmation is required, a confirmation object is returned,
    encapsulating a function and its optional arguments.
    """
    if any(pattern in text for pattern in keyphrases):
        if confirm:
            return confirmation(
                prompt           = confirmation_prompt,
                feedback_confirm = confirmation_feedback_confirm,
                feedback_deny    = confirmation_feedback_deny,
                function         = function,
                kwargs           = kwargs
            )
        if function and not kwargs:
            result = function()
        elif function and kwargs:
            result = function(**kwargs)
        else:
            result = None
        if response:
            return response
        elif not response and result:
            return str(result)
        else:
            return True
    else:
        return False
def trigger_keyphrases ( text = None , keyphrases = None , response = None , function = None , kwargs = None , confirm = False , confirmation_prompt = "Do you want to continue? (y/n)" , confirmation_feedback_confirm = "confirm" , confirmation_feedback_deny = "deny" ) : if any ( pattern in text for pattern in keyphrases ) : if confirm : return confirmation ( prompt = confirmation_prompt , feedback_confirm = confirmation_feedback_confirm , feedback_deny = confirmation_feedback_deny , function = function , kwargs = kwargs ) if function and not kwargs : result = function ( ) elif function and kwargs : result = function ( ** kwargs ) else : result = None if response : return response elif not response and result : return str ( result ) else : return True else : return False
Parse input text for keyphrases. If any keyphrases are found, respond with
    text or by seeking confirmation or by engaging a function with optional
    keyword arguments. Return text or True if triggered and return False if not
    triggered. If confirmation is required, a confirmation object is returned,
    encapsulating a function and its optional arguments.