Last week, I trained a neural network to generate the names of magic spells from the game Dungeons and Dragons, by giving it a list of existing spells and asking it to generate more like them. It obliged, with spells like “Charm of the Cods”, “Primal Rear”, and “Hail to the Dave”.
Blog reader Greg V suggested I try the same with the spells from Harry Potter. I used the list of spells from harrypotter.wikia.com, which includes not only the spells from the books, but also spells used in the movies and plays. The list included many with official names in questionable Latin (Arresto Momentum, Engorgio Skullus, Expelliarmus), and many more known only by their effects (Bubble-Head Charm, Endless Sandwiches, Twitchy-Ears Hex).
With about 560 spells to study, the neural network had a tendency to produce spells that were either exact repeats of existing spells or else terribly-mangled pseudo-Latin, but I did manage to find some apparently functional gems.
First, the charms. The Wiki quotes J.K. Rowling defining charms as “those spells which do not change the intrinsic character of the object on which the spell is cast". By that definition, the “Herring Charm” and “Cracker Charm” seen below do not manufacture herrings and crackers, but likely merely cause them to dance.
Hair Logs Charm
Ant Stacking Charm
The neural network also learned to produce jinxes, hexes, and curses, as well as a few unpleasant-sounding charms. Hard to tell whether the neural network would have been a valuable ally at the Battle of Hogwarts, or primarily a weird distraction.
Curse of the saris
Tragha Fracking hex
Curse on Marvolo Curse
It becomes clear, though, that the neural network doesn’t really understand what spells are, exactly. Here are a few that it invented. Note that “X to Y” type spells are transformation spells, so I’m not sure how turning a spell into a pug would work, exactly. It also seems to be searching unsuccessfully for the word “counterspell”.
Spell to pug
Spell to Rum
Spell to hum
Curse of spell
Spell to cure Spell
Spell Reversal spell
Charm to Cure Curse of Charm
Hex Hax Hex
The animagus spell, in which you turn yourself into an animal of your choice, is notoriously difficult. As a mark of its very advanced difficulty-ness, the spell itself is four words long, and annoying to remember: Amato Animo Animato Animagus
Maybe it’s memorable if you know Latin. The neural network doesn’t know Latin, though. And it has a heck of a time trying to cast the animagus spell:
Arato Agio Animagus
Amaro Amamoco Animagus
Amato Anima Animatus Charm
Amato Animo Animagus
Amanto Dure Anto Animato Animagus
Amato Animato Animagus
Animagus Antmater Charm
Arato Anima Animagus
Amato Animo Animogo
Amato Anima Mumora
Animagus Anto Animato Animagus
Beper andmoto Animagus
Amato Anima Anima to Animato Animagus
Arinta AnimaconStrag spell
Repello Inimato Animagus
It’s unclear what the neural network’s chosen animal form might be. Ox?
Its favorite spell, though? Curse of the Bogies. Garbled variations of that spell kept showing up over and over.
Jend-curse of the Bogies
Regrowing hair to curse of the Bogies
Curse of the Bogiegs
Misten per to Spell-barrh Counter-curse of the Bogies
Fineey curse of the Bogiess
Curse on to barter op Dhe Bogee’s
Curse of the Bogiess Curse
Sounger-curse of the Bogiess Curse
Tebbed to curse of the Bogies
Curse of the Mogies
Hex of the Bogery curse
And I think these two might be secretly versions of Curse of the Bogies
Soungor-curse of the Cougee spell
And perhaps there’s evidence that I didn’t clean up the text I extracted from the Harry Potter Wiki as much as I might have. One SINGLE stray line of css code, and now the neural network has latched onto it, convinced that “MediaWiki” does something powerful.
RediaWiki:Inf oforo Diolecum Charm
At other times, I couldn’t tell what the neural network was trying to do.
Mumbledore’s Reverore Inceacus Curse
Durser rabbity hair Logiot
Hork Lighty spell
Hord Ligery Spell
Mevitiblichainh’s grate Flare
Jigxe-sen tre Mucan to bog
Brechaim hedbivicus Doobers Spell
However, I’m beginning to suspect that the neural network might be making fun of the names.
Bubbiro forjuling Charm
Pockongum Dookors Spell
Other neural network Harry Potter experiments:
Become an AI Weirdness supporter to get bonus content! Or become a free subscriber to get new posts in your inbox.