Repolode
mumuy

mumuy/relationship

A Chinese kinship calculator that tells you what to call a relative, or how two relatives are related, in JavaScript.

Stars
3,737
Forks
407
Open issues
2
Last commit
20 days ago

What is it?

Relationship is a JavaScript library for working out Chinese kinship terms. Given a relative such as "妈妈的妈妈的哥哥", it returns the form of address used for that person, and it can also run in reverse to show what a relative should call you. It can also return the relationship chain behind a term, or the relationship between two people.

Input is flexible: the same role can be entered under several regional names, such as "老爸", "爹地" or "老爷子" for father, and the library accepts both plain-text sentences like "外婆和奶奶之间是什么关系?" and structured options. Custom regional modes can be added with setMode, and an optimal option computes the shortest relationship path between two people. It runs in browsers via a script tag and in Node.js via npm.

The project notes that many terms differ between northern and southern regions or carry more than one meaning, so results are not guaranteed to match every local custom.

Key features

  • 01Calculates the form of address from a relationship path, such as "妈妈的妈妈的哥哥".
  • 02Supports reverse lookup, showing how a relative should address you.
  • 03Returns relationship chains and the relationship between two people.
  • 04Accepts regional alternative names for the same relative.
  • 05Lets you define custom regional modes with setMode.
  • 06Works in browsers via a script tag and in Node.js via npm.

Use cases

  • Working out what to call distant relatives before a family gathering.
  • Building a family-tree or kinship app that needs Chinese address terms.
  • Adding a Chinese kinship lookup to a website or tool.
  • Exploring how Chinese kinship terms map onto family relationships.

Quick start

  1. 1

    Install the package from npm

    npm install relationship.js
  2. 2

    Require the module in Node.js (CommonJS)

    const relationship = require("relationship.js");
  3. 3

    Ask what to call a relative

    relationship({text:'妈妈的妈妈的哥哥'});

Things to know

  • Kinship terms vary by region, so results may not match your local usage.
  • Some terms have several meanings across generations, which can make results ambiguous.

Topics

FAQ

What is relationship?
A Chinese kinship calculator that tells you what to call a relative, or how two relatives are related, in JavaScript. Relationship is a JavaScript library for working out Chinese kinship terms. Given a relative such as "妈妈的妈妈的哥哥", it returns the form of address used for that person, and it can also run in reverse to show what a relative should call you. It can also return the relationship chain behind a term, or the relationship between two people.
Is relationship free to use? What license does it have?
relationship is open source under the MIT license. Check the license terms before using it in commercial products.
Is relationship still maintained?
Actively maintained. The last commit to relationship was on Oct 18, 2026.
What can I use relationship for?
Working out what to call distant relatives before a family gathering. Building a family-tree or kinship app that needs Chinese address terms. Adding a Chinese kinship lookup to a website or tool. Exploring how Chinese kinship terms map onto family relationships.
How do I install relationship?
Install the package from npm: npm install relationship.js Require the module in Node.js (CommonJS): const relationship = require("relationship.js"); Ask what to call a relative: relationship({text:'妈妈的妈妈的哥哥'});
Where can I get relationship?
The source code and installation instructions are on GitHub: https://github.com/mumuy/relationship

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects