In This Article, I will show you How to Create Artificial Intelligence Chatbot. This AI Will Respond You Most of The Questions You Ask.
You need the following software to continue:
1. Visual Studio (https://www.visualstudio.com/) (Visual studio 2015 community edition is free!)
2. A basic knowledge of C#
3. AIML Files Click Here For Download
Step 1: Creating the Project
Click “New” Then select a project. A dialogue window will appear where you can choose your project type, project name, and project location.
The window will have a list of projects depending on what is selected on the left-hand side. In our case we want to go to “Templates”, Then “Visual C#”.
Then click “Ok” at the bottom of the window.
Step 2: Designing
Add 2 Textboxes & 1 Button.
After Designing We Will Do The Main Step.
Step 3: Importing the Packages
Gather up the files you downloaded in step one (The AIMLbot.dll and the templates)
If you don’t have the solution explorer on the right-hand side of your screen showing all of the files in your project, Go to “View” at the top of the IDE and click “Solution Explorer”.
In the solution explorer Right click on the file which only contains your project name, It has an icon of “C#” in a box.
Then you want to click “Add”, Then “Reference…” This dialogue box allow’s us to add items to our project. If you chose a “Class Library” Then this is how you would add it to another project.
Now click “Browse” and the bottom of the Dialogue and navigate to the “AIMLbot.dll” you downloaded in step 1.
Step 3: The Code
Now Add The Main Code to The Button
Bot AI = new Bot(); AI.loadSettings(); //It will Load Settings from its Config Folder with this code AI.loadAIMLFromFiles(); //With this Code It Will Load AIML Files from its AIML Folder AI.isAcceptingUserInput = false; //With this Code it will Disable UserInput For Now User myuser = new User("Username Here", AI); //With This Code We Will Add The User Through AI/Bot AI.isAcceptingUserInput = true; //Now The User Input is Enabled Again with this Code Request r = new Request(textBox1.Text, myuser, AI); //With This Code it will Request The Response From AIML Folders Result res = AI.Chat(r); //With This Code It Will Get Result textBox2.Text = "Tutorial Bot: " + res.Output; //With this Code It Will Write the Result of Textbox1 Response to Textbox2 text //Now Coding Is Finished! //Now Add/Copy & Paste AIML Folder & Config Folder to the Project Directory //Now Test the Bot
These two slashes “// ” will not affect the program because these are comments. Visual Studio will show’s the comment as green.
Step 4: AIML & Config Folder (Final Step)
Now We Need to Copy & Paste The AIML & Config Folder to Your Project Main Binary Directory Like This:
or Watch Our Video Tutorial
Want to Download Source Code?