Skip to main content

Digital Trends may earn a commission when you buy through links on our site. Why trust us?

With a little technological magic, this dad build a sorting hat straight out of Harry Potter

Sorting Hat Lab Demo
Machine learning represents a paradigm shift in programming, there’s no doubt. The concept has begun to weave its promising tendrils through everything from Facebook’s image software to Gmail’s spam filter, but a crafty engineer thought up a better use: a real-life sorting hat inspired by the character in J.K. Rowlings‘s beloved
Recommended Videos
Harry Potter series.

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.

Kyle Wiggers
Former Digital Trends Contributor
Kyle Wiggers is a writer, Web designer, and podcaster with an acute interest in all things tech. When not reviewing gadgets…
Range Rover’s first electric SUV has 48,000 pre-orders
Land Rover Range Rover Velar SVAutobiography Dynamic Edition

Range Rover, the brand made famous for its British-styled, luxury, all-terrain SUVs, is keen to show it means business about going electric.

And, according to the most recent investor presentation by parent company JLR, that’s all because Range Rover fans are showing the way. Not only was demand for Range Rover’s hybrid vehicles up 29% in the last six months, but customers are buying hybrids “as a stepping stone towards battery electric vehicles,” the company says.

Read more
BYD’s cheap EVs might remain out of Canada too
BYD Han

With Chinese-made electric vehicles facing stiff tariffs in both Europe and America, a stirring question for EV drivers has started to arise: Can the race to make EVs more affordable continue if the world leader is kept out of the race?

China’s BYD, recognized as a global leader in terms of affordability, had to backtrack on plans to reach the U.S. market after the Biden administration in May imposed 100% tariffs on EVs made in China.

Read more
Tesla posts exaggerate self-driving capacity, safety regulators say
Beta of Tesla's FSD in a car.

The National Highway Traffic Safety Administration (NHTSA) is concerned that Tesla’s use of social media and its website makes false promises about the automaker’s full-self driving (FSD) software.
The warning dates back from May, but was made public in an email to Tesla released on November 8.
The NHTSA opened an investigation in October into 2.4 million Tesla vehicles equipped with the FSD software, following three reported collisions and a fatal crash. The investigation centers on FSD’s ability to perform in “relatively common” reduced visibility conditions, such as sun glare, fog, and airborne dust.
In these instances, it appears that “the driver may not be aware that he or she is responsible” to make appropriate operational selections, or “fully understand” the nuances of the system, NHTSA said.
Meanwhile, “Tesla’s X (Twitter) account has reposted or endorsed postings that exhibit disengaged driver behavior,” Gregory Magno, the NHTSA’s vehicle defects chief investigator, wrote to Tesla in an email.
The postings, which included reposted YouTube videos, may encourage viewers to see FSD-supervised as a “Robotaxi” instead of a partially automated, driver-assist system that requires “persistent attention and intermittent intervention by the driver,” Magno said.
In one of a number of Tesla posts on X, the social media platform owned by Tesla CEO Elon Musk, a driver was seen using FSD to reach a hospital while undergoing a heart attack. In another post, a driver said he had used FSD for a 50-minute ride home. Meanwhile, third-party comments on the posts promoted the advantages of using FSD while under the influence of alcohol or when tired, NHTSA said.
Tesla’s official website also promotes conflicting messaging on the capabilities of the FSD software, the regulator said.
NHTSA has requested that Tesla revisit its communications to ensure its messaging remains consistent with FSD’s approved instructions, namely that the software provides only a driver assist/support system requiring drivers to remain vigilant and maintain constant readiness to intervene in driving.
Tesla last month unveiled the Cybercab, an autonomous-driving EV with no steering wheel or pedals. The vehicle has been promoted as a robotaxi, a self-driving vehicle operated as part of a ride-paying service, such as the one already offered by Alphabet-owned Waymo.
But Tesla’s self-driving technology has remained under the scrutiny of regulators. FSD relies on multiple onboard cameras to feed machine-learning models that, in turn, help the car make decisions based on what it sees.
Meanwhile, Waymo’s technology relies on premapped roads, sensors, cameras, radar, and lidar (a laser-light radar), which might be very costly, but has met the approval of safety regulators.

Read more