Text Generation with Markov Chains in Python

Offered By
Coursera Project Network
In this Guided Project, you will:

l​earn about Markov chains and apply this concept to modeling and generating text.

Clock1 hour
IntermediateIntermediate
CloudNo download needed
VideoSplit-screen video
Comment DotsEnglish
LaptopDesktop only

In this project-based course, you will learn about Markov chains and use them to build a probabilistic model of an entire book’s text. This will be done from first principles, without libraries. Markov chains are a simple but fundamental approach to modeling stochastic processes, with many practical applications. By the end of this project, you will have generated a random new text based on the book you modeled, using code you wrote in Python.

Skills you will develop

Artificial Intelligence (AI)Probability TheoryPython ProgrammingNumpyMarkov Chain

Learn step-by-step

In a video that plays in a split-screen with your work area, your instructor will walk you through these steps:

  1. Read text from file

  2. Build a transition probability matrix

  3. Generate text using a Markov chain

  4. Improve capitalization, punctuation and spacing

  5. Improve text generation with k-token Markov chains

How Guided Projects work

Your workspace is a cloud desktop right in your browser, no download required

In a split-screen video, your instructor guides you step-by-step

Frequently asked questions

Frequently Asked Questions

More questions? Visit the Learner Help Center.