What you're trying, is very complicated if you expect it to understand English Grammar and respond accordingly ...(Well..it is AI !)
Otherwise, you could first try to match whole input sentences and...