The program uses three-word sequences. So, given two words X Y, it will choose a word Z that has followed them, favoring those that most often occurred.
See the main page for what these are and how you can modify it to make and use your own corpus.
—Mark Rosenfelder, 2018