Using the Bee Movie script.
Waiting for Input...
It takes the last 2 words in your sentence, looks in the bee-movie script for matches, and randomly decides which word should come next.
This next word becomes the current word, current becomes the last, and the process repeats for how ever many words.
When it reaches a word it does not recognize, or the word has ending punctuation, it'll start a new sentence by randomly picking a starting word from the script.
The console has a word-by-word breakdown.