The impetus for project lead Ryan Anderson, a tech hobbyist by night and a solutions architect for IBM by day, was a creation that would entertainingly instill in a young audience the importance of math, technology, and science. “I was thinking of fun projects and, coincidentally, I have a couple of daughters, and they are mad keen on ‘Harry Potter,'” he told Tech Insider. “They’ve read the books, like, five times.”
The first step was creating software capable of comprehending everyday speech. The storied sorting hat, described in “Harry Potter” as soothsaying headwear with the power to discern its wearers’ true nature, can speak and understand spoken phrases. In order to replicate that fantasy as faithfully as possible, Anderson tapped IBM’s Watson platform — specifically, its Natural Language Classifier and Speech to Text tools — to interpret the verbalization of wearers. The result? A system that can approximate a person’s character — “honesty,” for example, or “trustworthiness” — by the information they choose to volunteer.
Watson’s Natural Language Classifier is arguably the heart of Anderson’s sorting hat. The tool, which interprets the intent behind text and triggers a corresponding action, helps in sorting wearers into one of mystical school Hogwarts’ four distinct houses. The process begins with “ground truths,” or rows of descriptive words that a wearer might use in the course of conversation. Anderson and his daughters painstakingly categorized hundreds of descriptive adjectives — e.g., “courageous,” “brave,” and “witty” — by Hogwarts house. They’re Gryffindor, which emphasizes the traits of “daring, nerve, and chivalry”; Slytherin, which houses the “cunning” and “ambitious”; Hufflepuff, which seeks the “just” and “loyal”; and Ravenclaw, which comprises the “wise” and “clever.” (The final list contains more than 150 entries, Anderson said.)
Next up was giving the real-life sorting hat the gift of gab. That’s where Watson’s Speech to Text feature, which uses machine intelligence to decode the grammar and sentence structure of spoken phrases, worked its magic: the hat identifies words that match the “ground truths” table and returns the corresponding house. Better yet, it’s able to improve its responses over time by scouring the web, and has a built-in mechanism for accepting corrections in the (reportedly) rare instances when a wearer is sorted incorrectly.
As a test of the software’s sorting muscle, Anderson fed the hat the characteristics of famous people like Stephen Hawking, Hillary Clinton, and Donald Trump. The results? It sorted Hawking and Clinton into Ravenclaw “for their wits,” and Trump to Gryffindor for his “boldness.” Take those results as you will.
The sorting hats’s digital backbone is impressive enough, but Anderson went a step further. At a recent hackathon, he and a team of hardware engineers built a fully articulated animatronic “body,” of sorts, for the magical headpiece. Actuators furrow the hat’s brow if a wearer is sorted to Slytherin, and LED “eyes” glow bright green when someone’s labeled a Gryffindor.
Anderson’s daughters are enjoying the hat thoroughly, reportedly, but he’s not keeping the magic to himself: he’s documented the project thoroughly on GitHub. And soon, Anderson’s adding color to the hat’s responses. “I may, time permitting, for next Halloween give it more personality and make it more dynamic,” he told Tech Insider.