I have developed a few and the easy way is to remember past messages received and sent in session or for all time . You should also store the kind of response as such (statement, statement-question, question). You can then look at the last question you asked and see what the response was, really with storing the conversation you can compare older questions like if you sent "how old are you?" and then 3 messages later they said "I am 24" you can look at it like this [I, am, NUMBER] and look back looking for when you asked about a number recently with a check like this [how, old, you]. Really it's comparing the basic keywords first and then using that and going back to look at more complex as you go down the list. Simplest match usually is the correct for most statements.
This can be used in reverse seeing that you never said a [NUMBER] after a question looking for a number then break to a new conversation or a ELSE where you say "Just wondering" then when they say age after that you will know how to handle it.