Markov Chain: Train Lita to Speak in Someone Else’s Voice
In this section, you’ll use a Markov chain to respond to users’ questions. Markov chains are a technique for probabilistically generating content based on observations of past content. In a chatbot context, that means feeding a large corpus—lots and lots of words, such as a book or a collection of emails—into an analyzer and observing which words and phrases are most likely to come after any given word. As a small example, consider the following two sentences:
The cow jumped over the moon.
The quick brown fox jumped over the lazy dog.
If you were trying to implement a naive predictive text generator using only those two sentences as inputs, you could see that the word “jumped” is followed ...
Get Build Chatbot Interactions now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.