AIML是Artificial Intelligence Markup Language的缩写。这种语言基于XML,它易学习易掌握。使用AIML可以很容易的定制一个Alicebot或者从头开始创建一个Alicebot。Alicebot是种聊天机器人,参见http://www.alicebot.org/ 。

<p style="margin-left:7.5000pt;">
  下面简单的介绍下AIML的语法。
</p>

<p style="margin-left:7.5000pt;">
  AIML语言中最重要的四个标志:
</p>

<p style="margin-left:18.0000pt;">
  &middot;&nbsp;<aiml>:&nbsp;这个标签用来标志一个AIML文档的开始和结束。
</p>

<p style="margin-left:18.0000pt;">
  &middot;&nbsp;<category>:&nbsp;这个标志表示在Alicebot的知识体系里暂时无法理解的东西。
</p>

<p style="margin-left:18.0000pt;">
  &middot;&nbsp;<pattern>:&nbsp;用来描述一个简单的模式表示用户会同Alicebot说什么。
</p>

<p style="margin-left:18.0000pt;">
  &middot;&nbsp;<template>:&nbsp;用来描述Alicebot的回复。
</p>

<p style="margin-left:7.5000pt;">
  还有20余种标签会在AIML文件中经常碰到。你也可以创建你自己的&ldquo;定制标签&rdquo;。现在就开始学习使用AIML吧,这里有一个初级教程&nbsp;<a href="http://www.alicebot.org/documentation/">AIML&nbsp;Primer</a>。
</p>

<p style="margin-left:7.5000pt;">
  举例说明吧。免费的<a href="http://www.alicebot.org/downloads/">A.L.I.C.E.&nbsp;AIML</a>&nbsp;已经包含了一个基本的知识库,描述了大概41,000个category。看这个例子:
</p>

<p style="margin-left:7.5000pt;">
  <category><br /> &nbsp;&nbsp;&nbsp;&nbsp;<pattern>WHAT&nbsp;ARE&nbsp;YOU</pattern><br /> &nbsp;&nbsp;&nbsp;&nbsp;<template><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<think><set&nbsp;name="topic">Me</set></think>&nbsp;<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I&nbsp;am&nbsp;the&nbsp;latest&nbsp;result&nbsp;in&nbsp;artificial&nbsp;intelligence,<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;which&nbsp;can&nbsp;reproduce&nbsp;the&nbsp;capabilities&nbsp;of&nbsp;the&nbsp;human&nbsp;brain<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;with&nbsp;greater&nbsp;speed&nbsp;and&nbsp;accuracy.<br /> &nbsp;&nbsp;&nbsp;&nbsp;</template><br /> </category>
</p>

<p style="margin-left:7.5000pt;">
  <aiml>标签在这里没有显示出来,因为这里只是文档的一个节选。
</p>

<p style="margin-left:7.5000pt;">
  如你所见<categoray>与</category>之间,就是描述一个category啦!每个category可以有一个pattern和一个template,还可以有一个<that>标签的,但是我不想在这里讨论它。
</p>

<p style="margin-left:7.5000pt;">
  如上的category中的pattern只能够匹配精确的"what&nbsp;are&nbsp;you"(大小写忽略)。What&nbsp;are&nbsp;you&nbsp;你不会不认识吧,好吧,直译是"你是什么东西啊?"
</p>

<p style="margin-left:7.5000pt;">
  每个category还有可能被另外一个category调用,此时使用<srai>标签,这里也不作深入讨论。可以参见<a href="http://www.alicebot.org/documentation/srai.html">reductionism</a>.&nbsp;Reductionism大根是还原论,简约化的意思。很难译出!
</p>

<p style="margin-left:7.5000pt;">
  不管哪种情况,如果这个category被激发了,alicebot就会回答:"I&nbsp;am&nbsp;the&nbsp;latest&nbsp;result&nbsp;in&nbsp;artificial&nbsp;intelligence&#8230;"&nbsp;,前面<template>里面的东东。意思是:我是最先进的人工智能的产物。我能够以超快的速度和准确度模拟人脑的功能。另外,还有一些其它有趣的事情发生呢。注间到<think>标签吗?这会让Alicebot联想到这个对话的相关的一个限制,比如上面的例子就告诉alicebot,这个对向在讨论你自己。set&nbsp;name="topic",又赋值Me。于是对于alicebot的其它N多category,同样是topic的值为Me的category会被优先采纳。由此,这个机制能让你更好更准确的控制对话的流程。想想还有更多的机制呢,就看你的创造力设计一个聪明的聊天机器人啦!
</p>

<p>
  &nbsp;
</p></p>