PHP

Markov: Build a Text Generator

Feed it a book and it writes new sentences in the same voice. You build the great-grandparent of every language model, in about twenty lines.

PHPAdvancedFor fun, and portfolio-worthy

What you'll be able to build

Feed it a book and it writes new sentences in the same voice. You build the great-grandparent of every language model, in about twenty lines. Along the way you pick up real, transferable PHP skills, not just this one project:

  • an associative array of transitions
  • building pairs from a token list
  • seeding randomness for reproducibility
  • weighted random selection
  • a train-then-generate workflow
  • accumulating output

A course like this one

Yours is built from your own placement, so module count and depth will differ. This map shows what a advanced-level PHP learner building Markov actually gets.

  1. Module 1: Idiomatic PHP: string functions and the array_* family5 lessons

    Builds the production-ready version of the script for your markov.

  2. Module 2: Closures, arrow fns, and higher-order array functions5 lessons

    Builds the production-ready version of the reusable class for your markov.

  3. Module 3: Classes, interfaces, traits, and type declarations5 lessons

    Builds the production-ready version of the associative model for your markov.

  4. Module 4: array_map / filter / reduce and sorting associative data5 lessons

    Builds the production-ready version of the array pipeline workflow for your markov.

  5. Module 5: Loose vs strict comparison and the match expression5 lessons

    Builds the production-ready version of the function that powers your markov.

  6. Module 6: Exceptions, error contracts, and documented output3 lessons

    Builds the production-ready version of the command-line tool for your markov.

How the lessons actually work

Every lesson has you predict what a piece of PHP code will output before you run it, then run it for real in your browser and fix what you got wrong. Each module ends in a challenge gate with hidden tests, so you can't advance until your code actually works. The course closes with a capstone that assembles everything into Markov, and a runnable proof page tied to your own code.

Common questions

How long does the Markov: Build a Text Generator course take?

about 7 hours, across 6 modules and 28 lessons, at roughly 15 minutes per lesson. Your own course may run shorter or longer, since it's sized to your placement result, not a fixed template.

Do I need experience?

Yes. This is an advanced-tier PHP project, so it assumes you're already comfortable writing and reading PHP before you start.

How much does it cost?

$15 one-time, no subscription. The first module is free, so you can see exactly how the course teaches before you pay for the rest.

No subscription. Module one is free.

Build my Markov