Ruby

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 fifteen lines.

RubyAdvancedFor 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 fifteen lines. Along the way you pick up real, transferable Ruby skills, not just this one project:

  • a Hash with a default for transitions
  • each_cons for pairwise iteration
  • seeding random for reproducibility
  • sample and weighted choice
  • a train-then-generate workflow
  • accumulating with each_with_object

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 Ruby learner building Markov actually gets.

  1. Module 1: Idiomatic Ruby: symbols, ranges, and string methods5 lessons

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

  2. Module 2: Blocks, procs, lambdas, and yield5 lessons

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

  3. Module 3: Mixins, duck typing, and Comparable/Enumerable5 lessons

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

  4. Module 4: Enumerable mastery: map/reduce/group_by/each_with_object5 lessons

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

  5. Module 5: Truthiness, case/when, and the safe-navigation operator5 lessons

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

  6. Module 6: Error contracts, dependency-free packaging, 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 Ruby 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 Ruby project, so it assumes you're already comfortable writing and reading Ruby 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