The process is called Socratic questioning (or rabbinical reasoning).
You can implement the same thing in python-aiml for free.
https://github.com/paulovn/python-aiml/blob/master/aiml/botd...