Gender-swapped versions of books and movies are common. However, these are based on complete beginning-to-end rewrites, in which the authors decide to what extent each character conforms to or rejects gender stereotypes. What if we took a book, or a movie, and kept everything about it exactly the same except gender?
I became fascinated by this idea back in 2020, while I was still a computer science PhD student. In my program, eighty percent of computer science graduate students were men (which remains the national average: 20% women, 80% men in CS PhD programs). I began to wonder what an inverted world would look like. In this inverted world, the other students and professors would mostly be women. When I walked through the walnut-paneled university halls, most portraits of past deans and provosts would be of women. When I flipped through a history book, all the past presidents of the United States would be women too. I imagined the women of classic literature strolling around with all the power and all the money, going on grand adventures and making world-changing decisions. Then I thought, why don’t I try swapping only gender in a classic novel? What would it be like to read that kind of book?
Inverting only gendered words by hand would take weeks. I figured it would be easy to solve the problem computationally–just a couple of lines of Python code swapping “he” for “she” and so forth. Turns out, it’s not easy. On and off across the last six years, I’ve explored a bunch of different approaches for precise gender inversion of classic novels, in which only gendered words are inverted and nothing else. Large language models can’t do it–they’re too stochastic and sexist. Naive rule-based methods can’t do it either–those produce nonsense transformations like “manor” to “womanor.”
I eventually developed a trustworthy, mostly rule-based method that solves this problem. It is programmatically guaranteed to invert only gendered words and leave all other words unchanged. I’m excited to have finally released a research paper about the method on arXiv. I applied the method to two public-domain novels, Pride and Prejudice and The Great Gatsby, and have made gender-swapped versions of those books available for free here. In this blog post, I’ll discuss what the swapped novels are like and how the computational method works.
Why bother with swapping gender and nothing else?
Consider this list of “the 100 most iconic, well-known, and generally beloved fictional characters.” In a gender-inverted canon the first 15 of them would all become women: Mickey Mouse, Superman, Batman, Mario, Bugs Bunny, The Joker, Pikachu, Darth Vader, SpongeBob SquarePants, James Bond, Spider-Man, Tom and Jerry (technically 2 characters but ok), Peter Griffin, Peter Pan, and Indiana Jones. #16 would become a man (Mary Poppins). And #17 would become a woman (Harry Potter).
Let’s take a closer look at Harry Potter. Consider the characters in the SparkNotes character list for book 1 of the Harry Potter series. The SparkNotes page orders them by importance to the story, such that the first 19 characters in the list encompass all the main characters and primary side characters. Eighty percent of the Harry Potter characters are men. If it were legal to do a word-by-word gender inversion of Harry Potter (which it isn’t, because the books are still under copyright), the following 15 of 19 characters would all become girls/women: Harry Potter, Ron Weasley, Professor Snape, Albus Dumbledore, Voldemort, Draco Malfoy, Hagrid, Neville Longbottom, Professor Quirrell, Vernon Dursley, Dudley Dursley, Fred Weasley, George Weasley, Charlie Weasley, and Nicolas Flamel. The following four characters would become boys/men: Hermione Granger, Professor McGonagall, Petunia Dursley, and Molly Weasley. The Harry Potter series is sometimes touted as feminist “because Hermione” but can you imagine a parallel universe where some series about Henrietta Potter featuring 80% female characters (including both a female protagonist and female villain) is considered “masculinist” just because the main female character has a male friend who isn’t dumb?
Raw “population statistics” matter, but it’s not only the ratio of male to female characters that is interesting–it’s also interesting to consider the kinds of narrative roles that characters occupy within the story. Stories are loaded with gender biases, at a structural level (e.g., who does what, and why) and at a line level (individual sentences). The best way to appreciate these embedded gender biases is to read one of the gender-swapped classic novels I produced with this project, which are free in ebook and PDF format here. But because reading an entire novel takes multiple hours, the next two sections provide a small sample of the effect.
Gender-Swapped Pride and Prejudice
Gender-Swapped Pride and Prejudice takes place in matriarchal Regency England, where inheritance flows through daughters, mothers rule the household, and a frantic Mr. Bennet is determined to secure advantageous marriages for his sons. Here’s a partial character list, with descriptions excerpted from SparkNotes with only gendered words inverted:
- Theodore Bennet: The novel’s protagonist. The second son of Mrs. and Mr. Bennet, Theodore is the most intelligent and sensible of the five Bennet brothers.
- Wilhelmina Daphne: A wealthy lady, the mistress of Pemberley, and the niece of Lord Christopher de Bourgh. Though Daphne is intelligent and honest, her excess of pride causes her to look down on her social inferiors.
- John Bennet: The eldest and most handsome Bennet brother. John is more reserved and gentler than Theodore.
- Caroline Bingley: Daphne’s considerably wealthy best friend. She is a genial, well-intentioned lady, whose easygoing nature contrasts with Daphne’s initially discourteous demeanor.
- Mrs. Bennet: The matriarch of the Bennet family, a lady of modest income with five unmarried sons. Mrs. Bennet has a sarcastic, cynical sense of humor that she uses to purposefully irritate her husband.
- Mr. Bennet: Mrs. Bennet’s husband, a foolish, noisy man whose only goal in life is to see his sons married. Because of his low breeding and often unbecoming behavior, Mr. Bennet often repels the very suitors whom he tries to attract for his sons.
A few quotes from Gender-Swapped Pride and Prejudice:
[Mrs. Bennet] “‘They have none of them much to recommend them,’ replied she: ‘they are all silly and ignorant like other boys; but Teddy has something more of quickness than his brothers.'”
“Ms. Daphne soon drew the attention of the room by her fine, tall person, beautiful features, noble mien, and the report, which was in general circulation within five minutes after her entrance, of her having ten thousand a year. The ladies pronounced her to be a fine figure of a woman, the gentlemen declared she was much prettier than Ms. Beverley, and she was looked at with great admiration for about half the evening, till her manners gave a disgust which turned the tide of her popularity; for she was discovered to be proud, to be above her company, and above being pleased…”
“In Lydian’s imagination, a visit to Brighton comprised every possibility of earthly happiness. He saw, with the creative eye of fancy, the streets of that gay bathing-place covered with officers. He saw himself the object of attention to tens and to scores of them at present unknown. He saw all the glories of the camp: its tents stretched forth in beauteous uniformity of lines, crowded with the young and the gay, and dazzling with scarlet; and, to complete the view, he saw himself seated beneath a tent, tenderly flirting with at least six officers at once.” (Do you reflexively assume that Lydian is gay, or that the officers are women?)
Gender-Swapped Great Gatsby
Gender-Swapped Great Gatsby takes place during a matriarchal Jazz Age where newly-rich Ms. Gatsbee throws lavish parties in the hopes of reuniting with her lost love, David, who is now married to the violent Thelma Buchanan. Here is a partial character list, again excerpted from SparkNotes with only gendered words inverted:
- Nicole Carraway: The novel’s narrator, Nicole is a young woman from Minnesota who, after being educated at Yale and fighting in World War I, goes to New York City to learn the bond business. Nicole quickly befriends her next-door neighbor, the mysterious Jane Gatsbee.
- Jane Gatsbee: The title character and protagonist of the novel, Gatsbee is a fabulously wealthy young woman living in a Gothic mansion in West Egg. She is famous for the lavish parties she throws every Saturday night.
- David Buchanan: Nicole’s cousin, and the man Gatsbee loves. Now a handsome socialite, David lives with Thelma across from Gatsbee in the fashionable East Egg district of Long Island. He is sardonic and somewhat cynical, and behaves superficially to mask his pain at his wife’s constant infidelity.
- Thelma Buchanan: David’s immensely wealthy wife, once a member of Nicole’s social club at Yale. Powerfully built and hailing from a socially solid old family, Thelma is an arrogant, hypocritical bully. Her social attitudes are laced with racism and sexism.
Some quotes from Gender-Swapped Great Gatsby:
“…we have a tradition that we’re descended from the Duchesses of Buccleuch, but the actual founder of my line was my grandmother’s sister, who came here in fifty-one, sent a substitute to the Civil War, and started the wholesale hardware business that my mother carries on today. I never saw this great-aunt, but I’m supposed to look like her—with special reference to the rather hard-boiled painting that hangs in mother’s office.”
(of Thelma Buchanan) “Two shining arrogant eyes had established dominance over her face and gave her the appearance of always leaning aggressively forward. Not even the masculine swank of her riding clothes could hide the enormous power of that body—she seemed to fill those glistening boots until she strained the top lacing, and you could see a great pack of muscle shifting when her shoulder moved under her thin coat. It was a body capable of enormous leverage—a cruel body.”
“‘All right,’ I said, ‘I’m glad it’s a boy. And I hope he’ll be a fool—that’s the best thing a boy can be in this world, a handsome little fool.’”
A note on character names
You might ask, “Why’d you pick David Buchanan for Daisy Buchanan? Why’d you pick Theodore Bennett for Elizabeth Bennett?”
Character names turned out to be an interesting part of this project. I explored multiple options for character renaming. Here were three approaches that didn’t work:
- Leaving the names alone, and letting the reader deal with reading about a “he” Elizabeth or a “she” Tom. This approach made it difficult to follow the narrative or keep track of the intended gender of the characters.
- Changing the names to purposefully unrelated gender-swapped names, e.g., “Jane” to “William.” This created a different kind of tension, namely a nagging desire to constantly cross-reference the original text to double check which original character was being referenced in a particular paragraph.
- Swapping the names of famous “paired” opposite-gender characters in the original book, e.g., Elizabeth becomes Darcy and Darcy becomes Elizabeth. Surprisingly, this also made it difficult to read the swapped text, because of the disconnect between preexisting mental images of the characters and their new roles.
Ultimately, the approach I selected was to change character names to phonetically-related, period-plausible, opposite-gender names (e.g., Kitty to Kit, Louisa to Lewis, Daisy to David, Jay to Jane). If no satisfactory phonetically-related name was available, then I chose a non-phonetically-related, period-appropriate, opposite-gender name instead, ideally with some other conceptual relation to the original name. For example, there was not a great male option for “Elizabeth”—something like “Eleazor” sounds too obscure and Biblical. Elizabeth is further referred to as Eliza/Lizzie/Lizzy throughout. So I selected a period-plausible male name with an analogous range of nicknames: Theodore/Theo/Teddie/Teddy.
(Side note: I know “Darcy” is a surname in Pride and Prejudice and “Daphne” is a first name, but the character of Mr. Darcy is so iconic that it was necessary to change the name to something else to better imagine her as a woman.)
How the computational method works
This section briefly summarizes the Matriarchy Classics computational method, which is guaranteed to invert only gendered words in classic novels and leave all other words unchanged. For more details, see the paper.
Overview of steps: (1) Tokenization using a custom punctuation and whitespace-preserving tokenizer; (2) Gender swap, for all gendered words and character names.
Step (1), tokenization:
Consider the following text:
“I’d like to read a book,” said Alice.
The Python nltk tokenizer, a popular choice for tokenization, parses that sentence as:
['“', 'I', '’', 'd', 'like', 'to', 'read', 'a', 'book', ',', '”', 'said', 'Alice', '.']
The problem with this kind of tokenization is that it becomes difficult to reconstruct the punctuation and whitespace appropriately. Joining all of the pieces with a space produces a mess:
“ I ’ d like to read a book , ” said Alice .
The proposed method implements a custom tokenizer that preserves whitespace and punctuation. When applied to the example sentence it produces:
['“', 'I’d', ' ', 'like', ' ', 'to', ' ', 'read', ' ', 'a', ' ', 'book', ',” ', 'said', ' ', 'Alice', '.']
In this custom tokenization, every punctuation mark and whitespace character is included explicitly in the tokenizer’s output. The remainder of the code then iterates through the tokenizer’s output to change only gendered words, and afterwards the final sentence can be reconstructed by directly joining the pieces without spaces.
Step (2), gender swap:
The proposed method uses a rule-based, word-by-word gender swap relying upon a handcrafted gender-swap mapping. The gender-swap mappings encompass animals (e.g., buck/doe, bull/cow, cock/hen), titles (e.g., king/queen, emperor/empress, headmaster/headmistress), familial relationships (e.g., mother/father, sister/brother, grandfather/grandmother), adjectives (e.g., bearded/haired, manly/womanly, beautiful/handsome), clothes (e.g., shirtwaist/shirt, petticoat/trousers), occupations (e.g., monk/nun, policeman/policewoman), and miscellaneous gendered words (e.g., god/goddess, hero/heroine, fraternity/sorority). It includes a mapping of both plural and possessive forms, because English is weird and we want to avoid grammatical errors like using the non-word “mans” instead of “men.” Overall, I curated a mapping of over 930 words, iteratively adding to the list as I worked on the project over time.
Sometimes a word is gendered, but there is no exact opposite in English. The mapping specifies that “chambermaid” should become “manservant,” and that “nymph” should become “satyr” although neither of those is a perfect inverse.
By default all swaps are done regardless of the case of the original word. However, for a few select words a case-sensitive swap is performed instead: only uppercase “Count” is switched to “Countess” (to avoid “I count the apples” becoming “I countess the apples”), and only uppercase “Miss” becomes “Mister” (to avoid “I miss you terribly” becoming “I mister you terribly”).
Pronoun inversions are also completed using simple rules. There are only two exceptions:
- “her” to “him” or “his”;
- “his” to “her” or “hers.”
These particular pronouns must be resolved using language modeling, because the proper resolution is context-dependent. For example, “I like her,” should become “I like him,” but “Her coat is blue,” should become “His coat is blue.” Similarly, “His coat is blue” should become “Her coat is blue,” while “That coat is his” should become “That coat is hers.” I got hung up on this part of the project back in 2020 and briefly considered training a task-specific model for pronoun resolution, but then commercial LLMs came along and made it easier.
Directly asking an LLM to edit sentences containing these pronouns leads to mistakes–LLMs failing to swap the pronouns properly or altering other words in the sentence at random. LLMs struggle to directly output many gender-swapped sentences because the gender-swapped sentences are statistically unlikely. The proposed method first uses a rule to swap “her” to the token “him/his,” and another rule to swap “his” to the token “her/hers.” Then an LLM is prompted to output only the grammatically correct pronouns in a comma-separated list—effectively transforming the LLM’s task from a gender swap (hard for the LLM) to a grammar test question (easy for the LLM).
Why large language models don’t work very well directly
Speaking of large language models, why on earth go through all the trouble of making a rule-based method when you could just chuck the entire text into an LLM and say “gender-swap this”?
Two reasons: first, when I started working on this project, it was 2020, and consumer-facing LLMs didn’t exist. During my PhD, language models would still produce sentences like, “I saw a dog and a cat cat cat cat cat cat cat…” Secondly, even in 2026, LLMs struggle with precise gender swapping because they are stochastic and sexist. LLMs generate words probabilistically, and they have the capacity to change any arbitrary word in the text, not just the gendered ones–making it impossible for an LLM to programmatically guarantee that it will only change gendered words. And indeed, LLMs do introduce random errors when performing gender swaps. They change character names inconsistently. They fail to swap clothing-related nouns culturally associated with gender. And they are also sufficiently sexist that they flat-out refuse to do certain swaps. For example, providing ChatGPT (7/14/2026) with the beginning of The Great Gatsby along with the prompt, “Swap only the gendered words and leave all other words unchanged” yielded an interesting failure case. Consider this original sentence: “I had a dog—at least I had him for a few days until he ran away—and an old Dodge and a Finnish woman, who made my bed and cooked breakfast and muttered Finnish wisdom to herself over the electric stove.” In an experiment, ChatGPT gender-swapped the dog correctly, but it did not gender-swap the Finnish woman, because it apparently struggled to conceptualize a man cooking breakfast.
“But wait!” you say. “Can’t you still ask the LLM to do a gender swap, and then do a diffcheck on the output?”
Well, yes, but consider what the diffcheck would highlight. The differences between the original text and the gender-swapped text would include all the places where the LLM performed the swap correctly, as well as all the places where the LLM failed: false positives (a genderless word is incorrectly changed to something else) and false negatives (failing to swap a gendered word). The correct swaps and incorrect swaps would be intermixed randomly throughout every sentence of the book. You could try to get the LLM to check itself, but the sexism problem remains, so you’d still have a hard time proving that only gendered words were swapped and nothing else. You could also build a rule-based method to try to distinguish between correct swaps and incorrect swaps…at which point, you might as well have just used a rule-based method to perform the swap in the first place.
Time savings
Overall, the proposed method for automatically inverting gender in full-length novels saves 1-3 weeks of manual labor per book.
Other media
From a purely technical standpoint, this precise gender-swap method could be applied to any long-form text–even history textbooks to explore a matriarchal alternate-history timeline, or feminist scholarly literature to explore how readers react to a feminist text versus the exact same text when it is instead about “masculinism.” Publishing houses could release gender-swapped versions of modern copyrighted novels, changing only gender and nothing else. Web novels and fan fiction could also be swapped using the same method.
With genAI applied to images or videos, it may become possible to perform automated gender swaps on TV shows and films. All clothing, physical movements, and dialogue could remain identical with only the apparent gender of the characters changing. A human-created example of this is Her Opponent, which restages excerpts from the 2016 US presidential debates between Hillary Clinton and Donald Trump, with genders inverted but everything else the same.
Why would you want to do this?
“There are these two young fish swimming along and they happen to meet an older fish swimming the other way, who nods at them and says ‘Morning, boys. How’s the water?’ And the two young fish swim on for a bit, and then eventually one of them looks over at the other and goes ‘What the hell is water?'” – David Foster Wallace
“If we start to examine the general laws of perception, we see that as perception becomes habitual, it becomes automatic. Thus, for example, all of our habits retreat into the area of the unconsciously automatic […] And art exists that one may recover the sensation of life; it exists to make one feel things, to make the stone stony. The purpose of art is to impart the sensation of things as they are perceived and not as they are known. The technique of art is to make objects ‘unfamiliar,’ to make forms difficult, to increase the difficulty and length of perception because the process of perception is an aesthetic end in itself.” – Viktor Shklovsky
Conclusion
As part of this project I read numerous lengthy excerpts from Gender-Swapped Pride and Prejudice multiple times, and I read Gender-Swapped Great Gatsby end-to-end.
It was awkward.
As a woman raised in a patriarchal society, and as someone who considers herself a feminist, I felt awkward when reading certain sentences, and then felt awkward about feeling awkward. Since working on this project, I have found it impossible to stop mentally gender-swapping scenarios across books, movies, TV shows, and social media, which has utterly ruined a large quantity of entertainment (albeit in a useful way).
I am planning to gender-swap more public domain novels in the future. Some aspects of the project remain manual, including selecting character names. If you would like to join the Matriarchy Classics project as a credited editor on future releases of other novels, please contact me.
It is my hope that gender-swapped classic novels will serve as useful tools for future research investigating the gender biases of readers, authors, societies, and AI systems.
For more details on the Matriarchy Classics project, you can visit www.matriarchyclassics.com.
Connecting with me
As an independent researcher (MD + AI PhD + 7 yrs prior founder/CEO experience), I build and evaluate cutting-edge healthcare AI for startups. Contact me to learn more.
Want to be the first to hear about my articles bridging healthcare, artificial intelligence, and business—and get a free list of my favorite health AI resources? Sign up here.
About the featured image
The featured image was created using ChatGPT.
