https://en.wikipedia.org/wiki/ELIZA
If anyone is interested in diving into various implementations of this idea, there is a collection here https://github.com/jeffshrager/elizagen.org