aiml语言获取时间,日期

xiaoxiao2021-02-28  87

关于aiml的python调用方法,参考:http://blog.csdn.net/u011961856/article/details/75208321

本文主要介绍如何设计.aiml文件,输出时间,日期.

aiml内部有定以时间函数date,可以通过

<system>date</system>获得函数data的输出,通常我们还会为其定义一个pattern,

<category> <pattern>TIME</pattern> <template> <system>date</system> </template> </category>这样我们可以设计自己的pattern,而pattern的template为TIME的tempalte.

贴出.aiml文件代码如下:

<?xml version="1.0" encoding="UTF-8"?> <aiml version="1.0"><!--时间--> <category> <pattern>几点了</pattern> <template> <srai>TIME</srai> </template> </category> <category> <pattern>今 天 几 号</pattern> <template>今天是 <srai>TIME</srai> 。 </template> </category> <category> <pattern>今 天 星期几</pattern> <template>今天日期是<srai>TIME</srai> </template> </category><category> <pattern>TIME</pattern> <template> <system>date</system> </template> </category></aiml>

转载请注明原文地址: https://www.6miu.com/read-55331.html

最新回复(0)