Ответ AIML Chatbot отличается в разное время?
Отдельный вопрос для бота AIML в моем предыдущем посте... Как создать бота, который отвечает в разное время дня? Я чувствую, что это заставит его казаться более "реальным".
Я не могу понять, как на самом деле работает отображение даты и времени. Я предполагаю, что вам придется возиться с этим наряду с функциями set/get... но это все, что я знаю точно.
Я бы хотел, чтобы мой бот делал что-то подобное.
ВРЕМЯ: полдень
ПОЛЬЗОВАТЕЛЬ: Привет, бот.
БОТ: Добрый день, ПОЛЬЗОВАТЕЛЬ! Для меня это время обеда.
С чего мне начать? Благодарю.
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>