This chatbot is Written with reference to AIML 2.5 and Program-P, suitable for languages with UTF-8 encoding and word suffixes that change according to different tenses. Interested friends can do their own research and study.
git clone https://github.com/kompasim/chatbot.git. After downloading, complete the following steps You can upload it directly to your server.
The database uses MySQL. You can see the Config.php configuration file in the chatbot file Ai Ni Jia. And fill in the relevant information about the database.
Import chatbot.sql in the root directory into the database, which stores the configuration information of the chatbot , a table for requesting records and other information.
We open aiml/chatbot.aiml for editing or create a new aiml file and add our personalization Corpus, and then include the new aiml file to chatbot.aiml.
aiml corpus files must be placed under the aiml folder in the root directory . chatbot.aiml value entry file, the aiml root tag inside can contain multiple category tags, a default tag, and multiple include tags.
Other aiml files must first contain the topic tag in the aiml root tag, which then contains multiple categories and a default tag. It cannot There is an include tag.
After opening imdex.php, you can test the corpus we just added.
#If you want to call the chatbot in the public account or your own APP, we can call its api api like this. php?requestType=talk&input=Hello
The modified matching rules:
* ---> (\S+)
# ---> \S+
_ ---> .*
= ---> \S*
The aiml tag of this chat robot is different from the standard aiml tag. We You can find more tags supported by this chatbot in the AIML.MD file.
https://github.com/kompasim/chatbot
The above content is a PHP chatbot based on AIML. I hope it will be helpful to everyone.
Related recommendations:
PHP WeChat public platform development Chatbot development
How to use AIML to build a chatbot based on Python
Use Turing API to create a WeChat chatbot
The above is the detailed content of AIML-based PHP chatbot. For more information, please follow other related articles on the PHP Chinese website!