Harry Potter Sorting Hat
The Sorting Hat in Dumbledore's office on the set of Harry Potter at the Warner Bros Studio Tour London - The Making of Harry Potter, at Leavesden Studios on 30 March 2012 in Watford, England Gareth Cattermole/Getty Images

Have you ever wondered which house you would be sorted in if you went to Hogwarts? IBM solutions architect Ryan Anderson has built an actual, talking sorting hat inspired by JK Rowling's popular Harry Potter series for his daughters, eight-year-old Lucy and six-year-old Julia.

The innovative project initially started off as a fun way for the tech-savvy father to expose his little girls to science, technology, engineering and math (STEM) through their interest in the Harry Potter series.

"I was thinking of fun projects and, coincidentally, I have a couple daughters and they are mad keen on 'Harry Potter' - they've read the books like 5 times," Anderson told Tech Insider.

To find out which Hogwarts house you belong to - Griffindor, Ravenclaw, Hufflepuff or Slytherin - all you have to do is place the sorting hat on your head, spill a few details about your personality and wait for it to sort you accordingly.

The sorting hat uses Watson's Natural Language Classifier to analyse and interpret the intent behind a set of texts to trigger an action in response. Anderson and his daughter Lucy created "ground truths" to code the hat to pick up key descriptive words that fit the characteristics of each of the four Hogwarts houses.

For example, if you describe yourself as "witty" or "clever," you will be sorted into Ravenclaw, while describing yourself as "brave" or "chivalrous" will have you sorted into Griffindor. Other words like "cunning" or "ambitious" will likely make you a candidate for Slytherin, while traits like "honesty" and "loyalty" will place you into Hufflepuff.

According to Anderson, the list of ground truths contains more than 150 entries so far.

Anderson's sorting hat also uses Watson's Speech to Text feature that allows a user to speak to the sorting hat.

Using a branch of AI technology called deep learning - which allows machines to learn and train themselves to complete tasks on their own based on data patterns - the sorting hat is programmed to become smarter over time and add more characteristics to the list of ground truths. Anderson does note that if the sorting hat happens to make a mistake while sorting an individual, he can always go in and correct the ground truth.

Besides testing the sorting hat on his daughters and friends, Anderson has also inputted the characteristics of several famous people including Stephen Hawking, Hillary Clinton and even Donald Trump. While Hawking and Clinton were sorted into Ravenclaw for their cleverness with 90% certainty, Trump was sorted into Griffindor for his bold nature with 48% certainty.

To really bring the sorting hat to life, Anderson has added animatronics to the hat as well, allowing its eyes to turn green if you are sorted into Griffindor. If you are more suited for Slytherin, on the other hand, the hat's eyebrows will furrow.

To help spread the magic, Anderson has also provided a tutorial for the project on Github, allowing anyone to create their very own sorting hat as well.

"I may, time permitting, for next Halloween give it more personality and make it more dynamic," Anderson said.