Relationship is a JavaScript library that calculates Chinese kinship terminology and family relationships.
The tool solves the problem of determining correct familial titles in Chinese culture, where distant relatives and regional variations can make it difficult to know the appropriate form of address. It works by accepting input in multiple formats—either through structured options specifying two people and their relationship, or through natural language expressions like "X is what relation to Y" or "X calls Y what"—and returns the corresponding kinship term. The input system accommodates regional dialect variations, allowing users to enter terms like "老爸", "爹地", or "老爷子" for father. The algorithm supports reverse lookup, enabling users to find relationships from a given title.
The tool suits anyone navigating Chinese family dynamics who needs quick reference for proper titles, particularly useful during family gatherings where addressing distant relatives correctly matters. It works in both browser and Node.js environments, available through direct script inclusion or npm installation. The README acknowledges that some terms carry regional or generational ambiguity—for instance, certain titles can refer to multiple relationships depending on geography or family structure—and notes that the tool prioritizes modern usage conventions over historical or strictly regional interpretations.
The project maintains active test automation through continuous integration workflows. Development appears responsive to practical use cases, as evidenced by the deliberate design choice to support multiple colloquial input variations and the inclusion of reverse-lookup functionality. The tool includes comprehensive documentation of algorithm implementation principles and maintains awareness of edge cases and terminology conflicts inherent to the Chinese kinship system.