beanz Magazine

Harry Potter and the Predictive Keyboard

Karen Roe on Flickr

How AI technology is helping fans keep the magic alive for one more chapter.

Almost ten years after the release of the seventh Harry Potter book, the magical story of a boy who discovered he was a wizard has finally been updated with a new chapter. This text, however, wasn’t written by J. K. Rowling, but by an artificial intelligence. It starts like this:

“The castle grounds snarled with a wave of magically magnified wind.” Not bad, right? Then it gets weird: “Ron was standing there and doing a kind of frenzied tap dance. He saw Harry and immediately began to eat Hermione’s family.”

The great minds behind “Harry Potter and the Portrait of What Looked Like a Large Pile of Ash” are from Botnik, an online community of writers and developers who combine art and tech to “create strange new things.” To write this text, the authors used a predictive keyboard trained using all seven Harry Potter novels. You can real the full masterpiece here.

The magic of statistics

When texting on a smartphone, you’ve probably seen “word suggestions” pop up above the tiny digital keyboard. If you clicked on the first suggestion, and kept clicking until you had a full sentence, you’d be following the same process as the writers at Botnik. Except while phones analyze a person’s text messages, Botnik’s algorithm studied a specific author.

Predictive keyboards are built using a mathematical system called Hidden Markov Models (HMMs). The term may be fancy, but the logic boils down to this: every word in a sentence depends upon the previous word. Or, more accurately, upon several previous words.

Become a subscriber and get access to the rest of this article. Plus all our magazine articles.

Stories also include numerous links to help parents, kids, and teachers learn more. Get access today at just $15 per year for online magazine only or $29.99/year for print + online ($35/year outside US)!

Subscribe Today!

Also In The June 2018 Issue

Code up your digital turtle mascot and watch him dash around the screen in this simple Python coding activity.

A phone and tablet app exposes the invisible waves that connect our computers.

How AI technology is helping fans keep the magic alive for one more chapter.

Use Scratch to become the architect of your very own digital metropolis.

Use SketchUp to create dizzying patterns and shapes, Escher-style.

Whiz around your computer’s folders and modify files at lightning speed like a pro.

Use micro:bit and cardboard to create a Jedi knight that sounds the alarm when evil approaches!

Learn about the infamous Enigma machine and how its “unbreakable” code was finally defeated.

Take your 3D-printed gizmos to the next level with harder, sleeker, and stronger material.

How daily coding puzzles with constant feedback can be a useful tool to help students master text-based languages.

Scientists draw inspiration from nature to create remarkable specialized robots.

Links from the bottom of all the June 2018 articles, collected in one place for you to print, share, or bookmark.

Interesting stories about computer science, software programming, and technology for June 2018.