2026 · personal · Python + browser port
Anagrammer
When writing, I sometimes enjoy giving my characters names that are anagrams of some meaningful word or phrase. Doing this by hand is tedious, so I made this tool to help me out. Given any input text, it rearranges every letter into fictional character names that sound plausible and pronounceable.
Try it
Fetching the trained model…
How it works
The algorithm combines multiple generation tactics at different steps. A trigram character model trained on about 106,000 real names decides what letter sequences are the most name-like; a set of phonotactic rules ensure the names are pronounceable; and a composite scoring function ranks hundreds of candidates and returns the best ones.
Generating a plausible name using a machine learning model based on real names is not difficult, and there are many such generators available online. Making a name-like anagram is more complicated, since the model can never simply take the most likely next character; it can only choose from letters that haven't been used yet.
The pipeline
- Template selection. Ten name structures, from a bare mononym to First Middle Middle Last-Last. Only the ones whose length bounds fit your letter count are eligible, and hyphenated surnames unlock at sixteen letters.
- Guided construction. Each segment is built one character at a time, sampling from the Markov distribution over letters still available, with temperature controlling how closely it follows the model.
- Phonotactic lookahead. Candidate letters that would walk the segment into a dead end are filtered before they're sampled — invalid onset clusters, more than three consonants in a row, vowel pairs English doesn't use, a segment about to end with no vowel in it at all.
- Letter distribution. Any letters left stranded at the end are inserted back into existing segments at whichever position costs the least likelihood.
- Composite scoring. Candidates are ranked on Markov likelihood per character, length balance across segments, distance from a natural ~40% vowel ratio, starting-letter variety, repeated bigrams, and how cleanly the end of one segment runs into the start of the next.
- Filtering and diverse selection. Segments matching any of ~8,000 common English words are rejected. Final picks are made greedily with a penalty for reusing segments so that the list doesn't get saturated with ten variations on one letter sequence.
What this browser version leaves out
The full tool adds two refinement passes after construction: hill-climbing that swaps individual letters between segments, then a second pass that swaps whole syllables to find improvements single-letter moves can't reach. Those are the most intricate part of the codebase and the least visible on a single query, so they aren't ported here.
Everything else is the same algorithm working from the same trained model, and the scoring function agrees with the Python to six decimal places. The command-line version also supports locking in a specific first or last name, reproducible seeding, and verbose diagnostics.
Notes
- Everything runs in your browser. The model is a static file; nothing you type is sent anywhere.
- Name data comes from Kate Monk's Onomastikon (© 1997 Kate Monk), covering naming traditions worldwide.