CHATBOT IN PYTHON

BACKGROUND

Programming a Chatbot in python requires knowledge on specific principles used within the script. During my research period I observed ways where I can become more effective with the use of certain functions. These ways include the .format function which is used when putting two arguments together with a previous input within a string. For example, whatever the user enters is the input, like their name, now say I want to bring their name up again I would need to use the .format function. Other research included Python 3.0 since I wasn’t familiar with this new version of python. Stackoverflow.com provided great detail on how to tweak minor errors in the transition from Python 2.7 to 3.0. Going in to this project I was already aware of how to code for minor programs such as a calculator using built in functions. This, however, was a rigorous process because it was very time consuming compared to programming the calculator. Also, I had to take into account different responses as opposed to just one. The basics of computer programming is mathematics and logic. The Chatbot runs on an algorithm designed to work with words rather than numbers. Logic comes into play when you’re making simple lines such as, if “variable”=___ print (“___”) that is an example of a conditional statement which is commonly used. A conditional statement is similar to telling a child, if “the stove”=hot think(“don’t touch”). The major parts of my script are the ‘if’, ‘elif’, and ‘else’ statements. They are used when the input of the user negates what I coded for, this helps avoid discrepancies. Out of each statement the ‘if statement’ is the most straight forward, if {}= “__” : do this, and the program does what it is told to do. The ‘elif statement’ is the add-on to the ‘if statement’ it allows for more conditions. The ‘elif statement’ can be used as many times as possible, ‘elif’ means if the ‘if statement’ is not true, do this. Lastly the ‘else statement’ is when all is not true, do this. It’s essentially the backup to the backup.

EXPERIMENTAL DESIGN

The purpose of this project was to help portray the connection of humans and technology in a friendly and intuitive way. I thought what could better way of going on about this than sitting face to face and having an interaction between a human and technology. I programed my Artificial Intelligence to speak and respond as a human would, with full and thoughtful sentences. I also added in a little bit of humor and humility making emotion a factor. Most people look at technology and see wires, I see a companion, something that can make you better. According to sciencemag.org a computer knows you better than your friends and r do with all the access to your information a computer can “predict personal traits such as gender, race, political persuasion, and even sexuality”. My script consists of a number of different topics that will receive information and relate to them. This will highlight how insightful and interactive technology and humans could be fulfilling my goal of portraying the connection between humans and technology. The steps I took on designing the project weren’t complex by any means, they were however, rather long and straight forward. First off, I defined each topic whether it be movies, music or color, to an input prompt which asks the user a question about the topic. Then, based on the response I either replicated their input statement, what they answered, to a sentence which responds to their answer, or placed if, elif, and else statements to help cover a wide range of answers, accounting for multiple inputs scenarios in order, to responded to their input statement with the print function. After that, I prompt the user with another question keeping the conversation going and on and on again with the same method. The conversation should be 1-5 min long.

DATA/RESULTS

Time (Minutes)
Mother / 3
Brother / 2
Sister / 3
Average / 2:40

ANALYSIS/DISCUSSION

The data showed above confirms that I successfully completed my initial goal. It was intended to run for 1-5 minutes the averages were around 3 minutes, 2 minutes 40 seconds to be exact. To improve upon this project for next time I would need to figure out a way to have my program receive and ask questions by engaging in an actual conversation that wouldn't require a keyboard, instead, it would be voice activated. Allowing a person to carry a conversation while speaking, a more natural form of communication.

BIBLIOGRAPHY

Bohannon, John. "Your Computer Knows You Better than Your Friends Do."Sciencemag. AAAS, 12 Jan. 2015. Web. 8 Feb. 2015. >.

Hyekyung, Kim. "Dissertations & Theses - Gradworks." ProQuest Document View. Ann Arbor, 2007. Web. 31 Oct. 2014.

Morton, Dave. "How To Create Your Own Customised Chatbot For Beginners." Chatbots.org. AI4US Ltd., 13 June 2010. Web. 31 Oct. 2014.

NPE. "My Code in Python Is Not Working." - Stack Overflow. Creativecommons 3.0, n.d. Web. 31 Oct. 2014.

"Tutorials Point Simply Easy Learning." Python IF...ELIF...ELSE Statements. Tutoriolspoints, n.d. Web. 31 Oct. 2014.

Tutoriols, Programming. "Python Tutorial #7 - Conversation." YouTube. YouTube, 30 Oct. 2012. Web. 31 Oct. 2014.