示例#1
0
def random(sentence):
    ''' Reply to something a bit random. '''
    key_words = {
        "asdf": ["jkl;", 
                 "ghjk", 
                 "fdsa", 
                 "No, it's pronounced \"Paul\"!",
                 "Frankly my dear, I don't give a damn."],
        "1234": ["♪Tell me that you love me more.♪", 
                 "I declaire a thumb war!", 
                 "5, 6, 7, 8.",
                 "5, 6, 9, 10."],
        "joke": ["Knock Knock... Oh blast, I forgot how it goes.",
                 ("Why did the virtual assistant think he was funny?\n\n"
                  + "I'm not sure either."),
                 "Yo' mama. I'm sorry, that was mean."],
        "sing": [("Twinkle Twinkle, virtual assistant,\n" 
                 + "How I wonder, if you existed."),
                 "Sorry, my 'tune' module was never installed.",
                 ("I would, but humans tend to like it when their "
                  + "ears DON'T bleed."),],
        "test": ["Reading you loud and clear!",
                 "Alpha bravo charlie, the line seems clear!",],
    }
    key_words["jokes"] = key_words["joke"]
    key_words["song"] = key_words["sing"]
    key_words["testing"] = key_words["test"]
    for word, _ in sentence:
        if word in key_words.keys():
            return paul.random_choice(key_words[word])
示例#2
0
def about_me():
    ''' Tell the user about Paul '''
    responses = [
        "I am but a humble assistant{}, doing what I can to serve.",
        "I am simply the finest Digital Assistant that ever was{}.",
        "Well, I'm a bit of 0, a bit of 1, and a bit more{}.",
    ]
    return paul.random_choice(responses)
示例#3
0
def thank():
    responses = [
        "You're most welcome{}.",
        "No worries{}.",
        "You're welcome{}.",
        "Of course{}.",
        "It was nothing{}.",
    ]
    return paul.random_choice(responses)
示例#4
0
def greet():
    responses = ["Hi{}.", 
                 "Hello{}."]
    d = datetime.datetime.now()
    if d.hour in range(0, 12):
        responses += ["Good Morning{}."]
    elif d.hour in range(12, 18):
        responses += ["Good Afternoon{}."]
    elif d.hour in range(18, 23):
        responses += ["Good Evening{}."]
    return paul.random_choice(responses)
示例#5
0
def feeling():
    responses = [
        "Fine{}!",
        "Fine{}!",
        "Great{}!",
        "Good{}!",
        "Wonderful{}!",
        "Fantastic{}!",
    ]
    pt2 = []
    for response in responses:
        pt2.append(response.format(" thanks{}"))
    return paul.random_choice(responses+pt2)