python aiml标签用法

  • 2019 年 10 月 8 日
  • 筆記

aiml文件标签:   1   <aiml>  Defines the beginning and end of a AIML document.  2   <category>  Defines the unit of knowledge in Alicebot's knowledge base.  3   <pattern>  Defines the pattern to match what a user may input to an Alicebot.  4   <template>  Defines the response of an Alicebot to user's input.  <star>  Used to match wild card * character(s) in the <pattern> Tag.  <srai>  Multipurpose tag, used to call/match the other categories.  <random>  Used <random> to get random responses.  <li>  Used to represent multiple responses.<set>  Used to set value in an AIML variable.  6   <get>  Used to get value stored in an AIML variable.  7   <that>  Used in AIML to respond based on the context.  <topic>  Used in AIML to store a context so that later conversation can be done based on that context.  <think>  Used in AIML to store a variable without notifying the user.  <condition>  Similar to switch statements in programming language. It helps ALICE to respond to matching input.  <category>   <pattern> A * is a *. </pattern>  <template>   When a <star index = "1"/> is not a <star index = "2"/>?   </template>  </category>  <?xml version = "1.0" encoding = "UTF-8"?>   <aiml version = "1.0.1" encoding = "UTF-8"?>  <category>   <pattern>I LIKE *</pattern>   <template>   I too like <star/>.   </template>   </category>  <category>   <pattern>A * IS A *</pattern>   <template>   How <star index = "1"/> can not be a <star index = "2"/>?   </template>   </category>  </aiml>  <?xml version = "1.0" encoding = "UTF-8"?>   <aiml version = "1.0.1" encoding = "UTF-8"?>   <category>   <pattern> WHO IS ALBERT EINSTEIN </pattern>   <template>Albert Einstein was a German physicist.</template>   </category>  <category>   <pattern> WHO IS Isaac NEWTON </pattern>   <template>Isaac Newton was a English physicist and mathematician.</template>   </category>  <category>   <pattern>DO YOU KNOW WHO * IS</pattern>   <template>   <srai>WHO IS <star/></srai>   </template>   </category>   </aiml>  <?xml version = "1.0" encoding = "UTF-8"?>   <aiml version = "1.0.1" encoding = "UTF-8"?>   <category>   <pattern>WHAT ABOUT MOVIES</pattern>   <template>Do you like comedy movies</template>   </category>  <category>   <pattern>YES</pattern>   <that>Do you like comedy movies</that>   <template>Nice, I like comedy movies too.</template>   </category>  <category>   <pattern>NO</pattern>   <that>Do you like comedy movies</that>   <template>Ok! But I like comedy movies.</template>   </category>  </aiml>