aiml语言获取时间,日期

来源:互联网 发布:宁德catl知乎 编辑:程序博客网 时间:2024/06/04 23:20

关于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>



原创粉丝点击