<aimlversion="1.0.1"encoding="UTF-8"> <category><pattern>I am*</pattern> <template>Hello <setname="username"><star/>! </set></template> </category> <category><pattern>GoodNight</pattern> <template>Hi <getname="username"/> Thanks for the conversation!</template> </category> </aiml>
7、<that> :在AIML用于应对基于上下文。表示先前机器人说的话。
1 2 3 4 5 6 7 8 9 10 11 12 13
<aimlversion="1.0.1"encoding="UTF-8"> <category><pattern>WHAT ABOUTMOVIES</pattern> <template>Do you like comedymovies</template> </category> <category><pattern>YES</pattern> <that>Do you like comedymovies</that> <template>Nice, I like comedy moviestoo.</template> </category> <category><pattern>NO</pattern> <that>Do you like comedymovies</that> <template>Ok! But I like comedymovies.</template> </category> </aiml>
Human: What about movies?
Robot: Do you like comedy movies?
Human: No
Robot: Ok! But I like comedy movies.
8、<topic> :用于AIML存储上下文,这样以后可以谈话基于这一背景下进行。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<aimlversion="1.0.1"encoding="UTF-8"> <category> <pattern>LET DISCUSSMOVIES</pattern> <template>Yes <setname="topic">movies</set></template> </category> <topicname="movies"> <category> <pattern>*</pattern> <template>Watching good movierefreshes our minds.</template> </category> <category> <pattern> I LIKE WATCHING COMEDY!</pattern> <template>I like comedy moviestoo.</template> </category> </topic> </aiml>
Human: let discuss movies
Robot: Yes movies
Human: Comedy movies are nice to watch
Robot: Watching good movie refreshes ourminds.
Human: I like watching comedy
Robot: I too like watching comedy.
9、<think>:用于AIML存储变量不通知用户。
1 2 3 4 5 6 7 8 9 10
<aimlversion="1.0.1"encoding="UTF-8"> <category><pattern>My name is*</pattern> <template>Hello!<think><setname="username"><star/></set></think></template> </category> <category><pattern>Byeee</pattern> <template>Hi <getname="username"/> Thanks for the conversation!</template> </category> </aiml>
Human: My name is Mahesh
Robot: Hello!
Human: Byeee
Robot: Hi Mahesh Thanks for theconversation!
10、<condition>:类似的切换在编程语言语句。 它有助于ALICE来匹配输入作出响应。
1 2 3 4 5 6 7
<aimlversion="1.0.1"encoding="UTF-8"> <category><pattern> HOW ARE YOUFEELING TODAY </pattern> <template><think><setname="state"> happy</set></think> <conditionname="state"value="happy">I am happy!</condition> <conditionname="state"value="sad">I am sad!</condition></template> </category> </aiml>
Human: How are you feeling today
Robot: I am happy!
<aimlversion="1.0.1"encoding="UTF-8"?> <category><pattern> WHO ISALBERT EINSTEIN </pattern> <template>Albert Einstein was agerman physicist.</template> </category> <category><pattern> WHO ISIsaac NEWTON </pattern> <template>Isaac Newton was a englishphysicist and mathematician.</template> </category> <category><pattern>DO YOU KNOWWHO * IS</pattern> <template><srai>WHO IS<star/></srai></template> </category> <category><pattern>BYE</pattern> <template>Good Bye!</template> </category> <category><pattern>BYE*</pattern> <template><srai>BYE</srai></template> </category> <category><pattern>FACTORY</pattern> <template>DevelopmentCenter!</template> </category> <category><pattern>INDUSTRY</pattern> <template><srai>FACTORY</srai></template> </category> <category><pattern>SCHOOL</pattern> <template>School is an importantinstitution in a child's life.</template> </category> <category><pattern>_SCHOOL</pattern> <template><srai>SCHOOL</srai></template> </category> <category><pattern>_SCHOOL</pattern> <template><srai>SCHOOL</srai></template> </category> <category><pattern>SCHOOL*</pattern> <template><srai>SCHOOL</srai></template> </category> <category><pattern>_ SCHOOL*</pattern> <template><srai>SCHOOL</srai></template> </category> </aiml>
Human: I love going to school daily.
Robot: School is an important institutionin a child's life.
Human: I like my school.
Robot: School is an important institutionin a child's life.