ChatterBot 01 簡單示例

2022-08-30 05:18:14 字數 792 閱讀 7788

$ pip install chatterbot

$ pip install chatterbot --upgrade

from chatterbot import chatbot

chatbot = chatbot("ron obvious")

from chatterbot.trainers import listtrainer

conversation = [

"hello",

"hi there!",

"how are you doing?",

"i'm doing great.",

"that is good to hear",

"thank you.",

"you're welcome."

]chatbot.set_trainer(listtrainer)

chatbot.train(conversation)

response = chatbot.get_response("good morning!")

print(response)

chatterbot機械人每次接收到輸入時都會自主進行學習,如果已經訓練好機械人之後,不希望機械人再進行自主學習,可以設定為唯讀模式。當然可以使用這一特性來區分增量學習與生產應用。

chatbot = chatbot("johnny five", read_only=true)

NSDictionary plist簡單示例

在iphone ipad工程裡面,新增 file other property list,例如 test.plist,然後在其中新增3個專案 key name,date,dept,並填充value值。以下為對此test.plist檔案的一系列常用操作 myname,mydate,mydept為定義的...

NSDictionary plist簡單示例

在iphone ipad工程裡面,新增 file other property list,例如 test.plist,然後在其中新增3個專案 key name,date,dept,並填充value值。以下為對此test.plist檔案的一系列常用操作 myname,mydate,mydept為定義的...

簡單的正則表達示。

驗證數字 1 驗證n位的數字 d 驗證至少n位數字 d 驗證m n位的數字 d 驗證零和非零開頭的數字 0 1 9 0 9 驗證有兩位小數的正實數 2 0 9 驗證有1 3位小數的正實數 3 0 9 驗證非零的正整數 1 9 0 9 驗證非零的負整數 1 9 0 9 驗證非負整數 正整數 0 d 驗...