Parsing the sentence is the first part of the solution. As Don says, you need to identify the subject, predicate, direct and indirect object and assign them to roles. The predicate becomes a function call and the roles become its arguments.
To use this result it must be coupled with a knowledge base, typically encoded using first or higher order logic. The function calls produce a series of logical statements which can be confirmed or refuted by the knowledge base using logical resolution. The knowledge base maintains a model of the topics of the conversation and logical replies can be drawn from the model and expressed as sentences in natural language.
Here’s an example from VerbNet:
http://verbs.colorado.edu/verb-index/vn/urge-58.1.php#urge-58.1
The members section lists all the verbs with similar meanings, the roles section lists the arguments of the verb and restricts them according to various features such as concreteness or intelligence (useful for resolving ambiguity), and the final frames section lists the various patterns (syntax) in which you find those verbs and how the parts of the sentence map to the various roles. The semantics part defines a function call that you could use. You would still have to write the body of the function yourself, according to how your knowledge base works.