首页 技术原理解析内容详情

What Do You Call Your Father’s Brother’s Daughter? An Algorithm for Calculating Kinship Terms

2026-11-03 1 zhuadmin

Core Takeaways

  • TL;DR: Dad's older brother's daughter = tangjie (older) or tangmei (younger). Call her tangjie if she's older, tangmei if younger. Northern dialects sometimes call it "shubo jiemei".
  • Kinship is fundamentally a directed graph: people are nodes, "birth/marriage" are edges. Calculating a term = graph traversal + rule matching.
  • Tang vs. Biao rule in one line: if the first hop is "father" and the second is "father's sibling", it's tang. Everything else is biao.
  • Bi-directional queries (what I call her vs. what she calls me) can't just be inverted. You need a dedicated reverse mapping table.
  • Want to code it yourself? Define 9 atomic relations first, then derive combinations. Don't hardcode 100+ term strings—that's a time bomb waiting to explode.

---

Every Spring Festival brings the same production outage: a senior relative smiles at you across the dinner table, your internal kinship lookup API hits a timeout, and you choke out, "Uh... Happy New Year, Uncle."

Mom kicks your shin under the table: that's your biao-gufu (maternal aunt's husband).

The cringe factor rivals dropping the production DB without a backup. I've been eating this loss every year, so this time I'm just treating it as an algorithmic problem.

1. Kinship is a Graph, Not a Flat List

Nodes are people, edges are relationships: every edge is either parent-child (parent→child) or marriage (spouse↔spouse). There is no third type.

Why not a tree? Trees guarantee a single path between any two nodes. But once you add marriage edges and run cross-branch queries like "me → mom → maternal uncle → maternal grandmother", the structure becomes a mesh with cycles.

Edges are directed: "dad's older brother" and "brother's dad" are two completely different paths. A query string is essentially a token stream, e.g., `father, brother, daughter`.

Your job is to transpile that token stream into a Chinese kinship term. Plain English? It's a compiler frontend: lexical analysis, path folding, and semantic rule matching.

2. Algorithm Core: Path Decomposition + Atomic Rules

Define 9 atomic relations first: father, mother, older brother, younger brother, older sister, younger sister, son, daughter, spouse. This is your alphabet. Don't add or remove anything.

Do not start by hardcoding strings like "tang-waisheng" or "biao-zhixi". Why? Combinatorial explosion. Three hops across 9 atomic relations yields hundreds of paths. Hand-writing a mapping table until Chinese New Year is impossible. That's the classic architectural flaw.

The correct approach is layered folding:

1. Tokenize "dad's older brother's daughter" into `[father, brother, daughter]`;

2. Fold the first two hops: `father + brother` → bofu (uncle). The folding rule takes an age parameter: older brother = bofu, younger brother = shufu;

3. Fold again: `bofu + daughter` → triggers tang/biao classification → outputs tangjie/tangmei.

Folding order matters: start greedy folding from the queryer's end. Check the rule table at each step. On a miss, backtrack. Same strategy as a regex engine.

Where does age data come from? Ask the user. Force them to pick "older or younger than me". Don't gamble on a same-age default—that single fallback value is a time bomb for next year's dinner table.

3. Tang vs. Biao: Encoding Cultural Rules

This is the most "magical" part of the system, but strip it down and it's just one rule.

Same surname = tang, different surname = biao: if the bloodline hop occurs on the paternal male chain (father's siblings), it's tang. Everything else is biao.

Breaks down into four categories:

  • Tang: children of father's siblings. Same grandfather, same surname;
  • Gubiao: children of father's sisters;
  • Jiubiao: children of mother's brothers;
  • Yibiao: children of mother's sisters.

Objection: Isn't your aunt on your dad's side? Why are her kids biao? Because her kids take her husband's surname. Bloodline-wise, they've already exited your paternal clan. The classification is based on "clan affiliation", not "which table you sit at during New Year".

How does this map to code? Check the folded path: `if path[0] == "father" and path[1] == "brother"`, tag it `tang`. Else, tag it `biao`. Two lines of if-else. Magic instantly becomes logic.

4. Bi-directional Queries: Not a Simple Inversion

Terms are relative: if you call her tangjie, whether she calls you tangdi or tangmei depends on your gender and age delta.

Beginner trap alert: reverse all edges and rerun the algorithm? Wrong. Rerunning gives you "her perspective's path", but what you're missing isn't the path—it's the mapping.

Do this instead: maintain a bi-directional lookup table: `(A→B relation) => (how B addresses A)`. Feed both gender and age delta into the table lookup.

Why not reuse the forward algorithm? Because the age-comparison context is lost in the reverse path. Forcing it will silently misclassify "waisheng" as "zhizi". It'll pass CI/CD, crash at runtime (i.e., the dinner table), and you'll only learn the hard way.

5. Why English Gets Away with One "Cousin" While We Need 18 Terms

Classificatory vs. Descriptive: English kinship terms only classify. "Cousin" flattens gender, age, and paternal/maternal lines. Chinese is descriptive. Every term is a precise path description.

Do the math: 4 tang terms, 12 biao terms across three maternal/paternal lines, plus colloquial distant/affinal terms. Daily active vocabulary easily clears 18.

Why the granularity? Clan society uses terms for three things: establish inheritance order, define exogamy boundaries, and rank seating hierarchy. Tang cousins couldn't marry; biao cousins could. Imprecise terms = collapsed ritual/legal system.

From an algorithmic view: English hashes all cousin paths into a single bucket for O(1) retrieval. Chinese must expand all feature flags—gender × age × paternal/maternal × blood/affinal. It's a 4D join query. No wonder English speakers rarely build this, but we actually open it during holidays.

6. Production: A Minimal Implementation You Can Ship in an Afternoon

Skeleton at the pseudocode level, with a Pythonic flavor:

```python

ATOMS = {"f": "father", "m": "mother", "ob": "older_brother",

"yb": "younger_brother", "os": "older_sister", "ys": "younger_sister",

"s": "son", "d": "daughter", "sp": "spouse"}

def resolve(path, my_gender, age_cmp):

node = fold(path) # Greedy fold, backtrack on miss

tang = path[0] == "f" and path[1] in ("ob", "yb")

return build_call(node, tang, my_gender, age_cmp)

```

Two guaranteed footguns, warned in advance:

  • Cap the spouse edges: "older brother's wife" = saozi is fine, but "saozi's brother" shares zero bloodline with you. If the affinal chain exceeds one hop, just return "affinal relative, ask an elder";
  • Dialects are a rabbit hole: daye, dabai, and bofu all point to the same person. Output "standard term + common dialect alias" and stop. Don't try to exhaustively map every regional variant—that's a gazetteer project, not a utility.

Too lazy to code it? Fair. I wrapped this logic into a web app. Input "dad's older brother's daughter", and it instantly spits out tangjie/tangmei plus the reverse term: Kinship Term Calculator. Spend ten minutes pre-New Year running the relationship trees for both sides of your family. It's a passive-income prep task—get it right, nobody cares. Get it wrong, everyone remembers it for a year.

FAQ / Common Issues

Q1: Always mix up shen-shen and jiu-ma. Any mnemonic?

Check which "door" the marriage edge crosses: shen-shen enters the paternal door (father's younger brother's wife), jiu-ma enters the maternal door (mother's brother's wife). Memorize the door, not the face.

Q2: If a relative shares my surname, are they definitely tang?

Not necessarily. Even if your aunt's kids coincidentally share your surname, they're still biao by the rules. Classification follows the clan path, not the surname field on the hukou.

Q3: Is there a universal formula so I never have to memorize anything?

Yes, it's the path decomposition algorithm from this article. Its entire purpose is to kill rote memorization. But for distant relatives beyond three hops, just abort the derivation. Genealogy databases are notoriously dirty. Garbage in, garbage out.

  • 评论列表 (0条)

 暂无评论,快来抢沙发吧~

发布评论