日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人工智能 > ChatGpt >内容正文

ChatGpt

AIML标签

發布時間:2023/12/31 ChatGpt 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 AIML标签 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、基本標簽

<aiml>:定義在AIML文件的開頭和結尾。 它包含在版本和編碼屬性的版本和編碼信息。

?

<category>:定義unit ofknowledge中Alicebot的知識庫。每個類別包含在一個句子的形式,用戶輸入可以是一個斷言,問題和感嘆號等用戶的輸入可以包含通配符的字符,如*和_。用<category>標簽必須有<pattern>和<template>標記。

?

<pattern>:定義圖案什么用戶可輸入匹配到Alicebot。

?

<template>?:定義一個Alicebot的用戶的輸入的響應。<template>標簽可以保存數據,可以調用另一個程序,能夠給條件答案或委托給其他類別。

《例子的使用方式:打開命令提示符,cd到工程目錄下,在工程目錄下執行是:

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

?

2、<*> :用于匹配通配符*character(s)在<pattern>標簽。

例子:

<category><pattern> A * is a *.</pattern>

<template>When a <starindex="1"/> is not a <star index="2"/>?</template>

</category>

human:A mango is a fruit.

Robot:When a mango is nota fruit?

?

3、<random> :用于獲取隨機響應。

4、<li> :用來表示多個響應。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="1.0.1"encoding="UTF-8"?>

<category><pattern>HI</pattern>

<template><random>

???????????<li> Hello! </li>

???????????<li> Hi! Nice to meet you! </li>

????????</random>

</template>?

</aiml>

Human: Hi

Robot: Hi! Nice to meet you!

Human: Hi

Robot: Hello!

?

5、<set> :使用在AIML變量設定值。

6、<get> :用于獲取存儲在AIML變量的值。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="1.0.1"encoding="UTF-8"?>

<category><pattern>I am*</pattern>

<template>Hello <set name="username"><star/>! </set></template>?

</category>?

<category> <pattern>GoodNight</pattern>

<template>Hi <getname="username"/> Thanks for the conversation!</template>?

</category>?

</aiml>

Human: I am Mahesh

Robot: Hello Mahesh!

Human: Good Night

Robot: Good Night Mahesh! Thanks for theconversation!

?

7、<that> :在AIML用于應對基于上下文。表示先前機器人說的話。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="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存儲上下文,這樣以后可以談話基于這一背景下進行。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="1.0.1"encoding="UTF-8"?>

<category><pattern>LET DISCUSSMOVIES</pattern>

<template>Yes <setname="topic">movies</set></template>?

</category>

<topic name="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存儲變量不通知用戶。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="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來匹配輸入作出響應。

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="1.0.1" encoding="UTF-8"?>

<category><pattern> HOW ARE YOUFEELING TODAY </pattern>

<template><think><setname="state"> happy</set></think>

<condition name="state"value="happy">I am happy!</condition>

<condition name="state"value="sad">I am sad!</condition></template>

</category>

</aiml>

Human: How are you feeling today

Robot: I am happy!

?

11、<srai>:多用途標簽,用來調用其它/匹配的類別。(符號縮減、分而治之、同義詞分辨率、關鍵詞檢測)

例子:

<?xml version="1.0"encoding="UTF-8"?>

<aiml version="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.

?

12、<upcase>xiaoxie</upcase>元素用來把xiaoxie轉換成大寫形式:XIAOXIE

?

13、<system><system>元素表示調用系統函數,例如:<system>date</system>表示取系統當前日期

?

14<sentence>元素用來格式化句子,比如:<sentence>this is some kind ofsentence test.</sentence>可以格式化成:This is some kind of sentence test.即把句子首字母大寫。

?

15、<pattern>表示匹配模式,里面的內容必須大寫,可以有星號*?或下劃線_,但必須空格隔開,星號表示匹配所有,任意情況;下劃線的意義跟星號一樣,除了不能匹配字典里面Z后面的字母。

?

16、<lowcase></lowcase>表示把中間的內容變成小寫,對應的是<upcase>把內容變成大寫
???????????中文無效。

?

17、<learenfilename=”xxx.aiml”>元素表示讓機器人學習某個aiml文件。

?

18、<if>元素,判斷元素,有以下形式:<if name="topic"value="cars"></if>?<if name="topic"contains="cars"></if>?<if name="topic"exists="true"></if>

?

19、<formal>元素,用來格式化輸出,例如:<formal>jon baer</formal>那么回復將被格式化成首字母大寫輸出:Jon Baer,對中文無效。


20、<NUM/>元素,匹配數字

21、約束匹配模式

<category>

<pattern that="你好">你好啊</pattern>

<template>

<random><li>你好,我們剛剛說過一遍了。</li>

<li>你好,客氣啥!</li>

</random></template> </category>

上述示例中,并不會直接命中”你好啊“,而是在上一次是匹配的”你好“,當又匹配了”你好啊“才會命中上述category,即上次和當前次的連續匹配。

?注:匹配優先級別分別是文字>#>^

參考鏈接:http://www.w3ii.com/zh-CN/aiml/default.html

http://blog.csdn.net/woowindice/article/details/302298

?

總結

以上是生活随笔為你收集整理的AIML标签的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。