You always have some grammar and vocabulary structure for it to understand, or ignore, or ask to have the message rephrased, or you simply respond "I don't know. Do you?"
At the most base level you capture negative words like 'wont, cant, shouldn't, no, not" and vulgarities and respond "you shouldn't be so negative" or "are you just saying that to be difficult?" or "what do you really mean?"
You feed it nouns in context: food, nature, home, family, computers, etc.
You feed it adjectives on a value basis, positive, negative, exaggerating, counting, worth.
There must be some way of teaching sentence structure.
I bet there's a whole science to this.
In the context of teaching a kid to program though you only need to get as far as NPC interactions.
Shopkeeper={}
Shopkeeper.phrases={"hello welcome to my shop","that item costs","are you sure you want to buy it?","You don't have enough Gmoney yo!","Thank you,come again"}
Shopkeeper.items={ {"sword",1},{"shield",2},{"boots",1},{"spartan armor",3}}
In this case the user is only given a greeting, a menu of items, an option to buy or
not buy the selection, a warning about poverty and a traditional send off.
It all works similarly.