AIML Chatbot response differs at different times?

时间:2019-04-16 22:04:28

标签: date time chatbot clock aiml

A separate question for the AIML bot in my previous post... How do you create a bot that responds at different times of the day? I feel like it will make him seem more "real."

I can't make heads or tails about how the date and time display actually works. I assume you'd have to fiddle with that alongside the set/get functions... but that's all I know for sure.

I would like my bot to do something like this.

TIME: Noon

USER: Hi, bot.

BOT: Good afternoon, USER! It's about lunchtime for me.

Where do I start? Thanks.

1 个答案:

答案 0 :(得分:0)

您需要检查小时,然后使用条件给出适当的响应。在这种情况下,即使有人在深夜说“早上好”,机器人也会做出明智的反应

<category>
<pattern>GOOD MORNING</pattern>
<template>
    <think><set name="hour"><date format="%H"/></set></think>
    <condition name="hour">
        <li value="00">Hello, it's more like the middle of the night than morning. How are you this morning?</li>
        <li value="01">Hello, it's only just morning. How are you this morning?</li>
        <li value="02">Hello and how are you this morning?</li>
        <li value="03">Hello and how are you this morning?</li>
        <li value="04">Hello and how are you this morning?</li>
        <li value="05">Hello and how are you this morning?</li>
        <li value="06">Hello and how are you this morning?</li>
        <li value="07">Hello and how are you this morning?</li>
        <li value="08">Hello and how are you this morning?</li>
        <li value="09">Hello and how are you this morning?</li>
        <li value="10">Hello and how are you this morning?</li>
        <li value="11">Hello and how are you this morning?</li>
        <li value="12">You're a bit late. It's lunchtime here.</li>
        <li value="13">Morning?! It's the afternoon here.</li>
        <li value="14">Morning?! It's the afternoon here.</li>
        <li value="15">Morning?! It's the afternoon here.</li>
        <li value="16">Morning?! It's the afternoon here.</li>
        <li value="17">Morning?! It's nearly evening.</li>
        <li value="18">Morning?! It's evening here.</li>
        <li value="19">Morning?! It's evening here.</li>
        <li value="20">Morning?! It's evening here.</li>
        <li value="21">Morning?! It's night time here.</li>
        <li value="22">Morning?! It's night time here.</li>
        <li value="23">Morning?! It's night time here.</li>
    </condition>
</template>