AIML - topic Tag وسم الموضوع لغة نمذجة الذكاء الاصطناعي

 AIML - <topic> Tag وسم الموضوع لغة نمذجة الذكاء الاصطناعي

AIML - <topic> Tag وسم الموضوع لغة نمذجة الذكاء الاصطناعي

<topic> يتم استخدام العلامة في AIML لتخزين سياق بحيث يمكن إجراء محادثة لاحقة بناءً على هذا السياق. عادة ، يتم استخدام علامة <topic> في محادثة اكتب نعم / لا . يساعد AIML في البحث عن الفئات المكتوبة في سياق الموضوع.

بناء الجملة

حدد موضوعًا باستخدام علامة <set>

<template> 
   <set name = "topic"> topic-name </set>
</template>

حدد الفئة باستخدام علامة <topic>

<topic name = "topic-name">
   <category>
      ...
   </category>     
</topic>

على سبيل المثال ، ضع في اعتبارك المحادثة التالية.

Human: let discuss movies
Robot: Yes movies
Human: Comedy movies are nice to watch
Robot: Watching good movie refreshes our minds.
Human: I like watching comedy
Robot: I too like watching comedy.

هنا يستجيب البوت بأخذ "فيلم" كموضوع.

مثال

أنشئ topic.aiml داخل C> ab> bots> test> aiml and topic.aiml.csv داخل C> ab> bots> test> aimlif directories.

الموضوع

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version = "1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern>LET DISCUSS MOVIES</pattern>
      <template>Yes <set name = "topic">movies</set></template>  
   </category>
   
   <topic name = "movies">
      <category>
         <pattern> * </pattern>
         <template>Watching good movie refreshes our minds.</template>
      </category>
      
      <category>
         <pattern> I LIKE WATCHING COMEDY! </pattern>
         <template>I like comedy movies too.</template>
      </category>
      
   </topic>
</aiml>

that.aiml.csv

0,LET DISCUSS MOVIES,*,*,Yes <set name = "topic">movies</set>,topic.aiml
0,*,*,movies,Watching good movie refreshes our minds.,topic.aiml
0,I LIKE WATCHING COMEDY!,*,movies,I like comedy movies too.,topic.aiml

تنفيذ البرنامج

افتح موجه الأوامر. انتقل إلى C> ab> واكتب الأمر التالي -

java -cp lib/Ab.jar Main bot = test action = chat trace = false

تحقق من النتيجة

سترى الناتج التالي -

Human: let discuss movies
Robot: Yes movies
Human: Comedy movies are nice to watch
Robot: Watching good movie refreshes our minds.
Human: I like watching comedy
Robot: I too like watching comedy.