DEV Community

Liu Xiaojun
Liu Xiaojun

Posted on Edited on Originally published at dev.to

I built a Chinese-to-English name bridge with 7,490 characters and no API

Picking an English name to go with a Chinese one usually goes one of two ways. Either someone keeps the pinyin and hopes people can pronounce it, or they pick an English name that sounds vaguely similar and loses the meaning entirely. Both are legitimate choices. The problem is that you can't see the options side by side.

So I built a small tool that puts them side by side. You type a Chinese name, and it shows three routes at once: keep the pinyin, match by sound, and match by meaning. It also runs backwards — type an English name and it suggests Chinese characters by sound or by meaning.

Try it: Chinese–English name bridge (there's an English version too).

The three routes, and why none of them is "the answer"

1. Keep the pinyin. This is the default for a reason. Li Wei stays Li Wei, and the surname keeps its place. The tool shows the pinyin first for every character so the original is never lost.

2. Sound match. For each syllable, there's a table of English names that sound close — Wei → Wayne / Wendy / Wesley, Min → Mina. This is a curated table, not a phonetic algorithm: an algorithm happily matches Xu to Sue, which is closer than it looks but not what a native speaker hears.

3. Meaning match. Each character in the curated set carries an English gloss and a semantic tag — 岚 is "mountain mist" and tagged nature, 铮 is "upright; firm" and tagged virtue. The tool suggests English names from the same tag group: 岚 → Aurora / Ivy / Flora. This route is the most subjective, and the interface says so.

The important thing is that the tool doesn't pick for you. It never claims one English name is "correct" for a Chinese name. It shows three honest options and leaves the decision to the person.

The character library: why 7,490

The obvious way to build this is a small hand-picked set of maybe 100 common name characters. That covers about 95% of real names and is easy to maintain. It also fails the moment someone's name uses a character outside the set — which, for a tool about names, is exactly when you need it most.

So the library is layered instead:

  • 130 curated characters with handwritten English glosses and semantic tags. These drive the meaning-match route and get priority in suggestions.
  • 44 characters in active use elsewhere on the site (gender references and surname tables) — 涵, 鹏, 雯, 昊 and so on. These were a real gap: the site recommended them, but the bridge didn't know them.
  • 7,316 characters from the Shuowen Jiezi (《说文解字》), an ancient Chinese dictionary. These have the original dictionary definition but no invented English translation. If you type a rare character, the tool shows "《说文》原义" and the source definition — honest about what it does and doesn't know.

Total: 7,490 characters, all resolved in the browser.

The hard part wasn't the count. It was the encoding. The Shuowen set includes characters in CJK Extension B and beyond, which are surrogate pairs in JavaScript — a naive charAt loop silently drops them. Pinyin tones are a second trap: ā/á/ǎ/à all need to fold to a before a table lookup, and one source used the Latin small letter ɡ (U+0261) instead of the ASCII g, which broke sound matching for an entire subset until I normalized it.

Sound matching: 168 exact, 225 approximate, zero silent gaps

The first version of the sound table covered 168 syllables with hand-checked English names. When I loaded the full Shuowen library, 225 more syllables had no entry at all. Dropping them would have meant a rare character either returned nothing or fell through to a crude "same first letter" fallback.

So I added a second table of 225 syllable-level approximations. The lookup order is now:

exact syllable table → approximate syllable table → first-letter fallback
Enter fullscreen mode Exit fullscreen mode

Each result is labelled with which layer produced it — "approximate by syllable, not an exact sound match" or "approximate by initial". A range of Quinn / June for 赹 (qióng) is useful; presenting it as an exact transliteration would be a lie. For a naming tool, that distinction matters more than coverage.

After the expansion, a full scan of all 7,490 characters found zero with no candidate at all.

Everything runs client-side

There's no API, no backend, and no account. The character library, the pinyin tables, the sound tables and the English glosses are plain JavaScript files loaded by the page. Nothing you type leaves the browser — which matters, because a name plus a birth date is about as personal as input gets.

The site this lives on is plain static HTML deployed to Cloudflare Pages, generated by small Python scripts. The open surname dataset that feeds the surname tables is CC BY 4.0, JSON + CSV, 109 surnames with pinyin, founding ancestor, commandery, hall names and population rank. The bridge reuses that data rather than keeping a second copy.

What I got wrong

Three things worth not repeating:

  • CJK extension characters were silently dropped. isHan used a BMP range check. I switched to codePointAt and extended the upper bound to U+323AF. The characters just vanished before, with no error.
  • Cached scripts hid the fix twice. After each data expansion the browser kept serving the old JS. Every data file now carries a version query string (?v=7490) referenced from both the Chinese and English pages.
  • The meaning route was polluted by rare characters. Once all 7,316 Shuowen characters were in the library, meaning-match started suggesting obscure characters nobody should name a child. The extra characters are marked as non-curated and excluded from the priority suggestions.

The tool is deliberately modest. It doesn't generate names, score them, or tell you what to pick. It puts three reasonable translations of a Chinese name in front of you and gets out of the way.


The Chinese–English name bridge is live. The 109-surname dataset is open under CC BY 4.0 — corrections and suggestions are welcome.

Top comments (0)