extended version of the chatbot project from chapter 12 of Beginning Ruby