發表文章

目前顯示的是 6月, 2018的文章

python實作聊天機器人

圖片
先下載安裝 PyPi 套件: pip install chatterbot 安裝完成之後,我們就可以開始透過 Python 來使用 ChatterBot 了! import numpy as np import pandas as pd from chatterbot import ChatBot # 建立一個 ChatBot 物件 chatbot = ChatBot(     'Ron Obvious',     trainer = 'chatterbot.trainers.ChatterBotCorpusTrainer' ) # 載入英文的基本語言庫 chatbot.train("chatterbot.corpus.english") # 載入(簡體)中文的基本語言庫 chatbot.train("chatterbot.corpus.chinese") # 載入(簡體)中文的問候語言庫 chatbot.train("chatterbot.corpus.chinese.greetings") # 載入(簡體)中文的對話語言庫 chatbot.train("chatterbot.corpus.chinese.conversations") # 與 ChatBot 對話,並且取得回應 chatbot.get_response("今天天氣") <Statement text:你要去那裡> 文章來源: https://kantai235.github.io/2017/03/16/ChatterBotTeaching/