Coder Social home page Coder Social logo

familytreemaker's Introduction

familytreemaker

This program creates family tree graphs from simple text files.

The input file format is very simple, you describe persons of your family line by line, children just have to follow parents in the file. Persons can be repeated as long as they keep the same name or id. An example is given in the file LouisXIVfamily.txt.

Note: This branch version is optimized for chinese. If other language for input text file is used, command option gender (-g) has to be used to specify words of male and female, since their default values are set as "男" and "女" instead of origin "M" and "F".

Installation

Simply clone the repo or install package familytree by pip as shown below:

pip install familytree

This script outputs a graph descriptor in DOT format. To make the image containing the graph, you will need a graph drawer such as [GraphViz] 1.

Usage

usage: familytreemaker.py [-h] [-a ANCESTOR] [-g GENDER] [-v INFOLEVEL]
                          [-o OUTFILE]
                          INPUTFILE

Generates a family tree graph from a simple text file

positional arguments:
  INPUTFILE     the formatted text file representing the family

optional arguments:
  -h, --help    show this help message and exit
  -a ANCESTOR   make the family tree from an ancestor (if omitted, the program
                will try to find an ancestor)
  -g GENDER     customized gender string, for example: "男,女" or "M,F"
  -v INFOLEVEL  Information level (0/1/2) to output. (0 - only name and
                surfname will be output; 1 - time of birthday and deathday
                will be invisable; 2 - all information will be output)
  -o OUTFILE    file name for output

The sample family descriptor LouisXIVfamily.txt is here to show you the usage. Simply run:

python familytreemaker.py -a "王灿文" -v2 -o LouisXIVfamily.dot LouisXIVfamily.txt && \
    dot -Tsvg -o LouisXIVfamily.svg LouisXIVfamily.dot

If package familytree has been installed by pip, commands below can be performed to populate:

python -m familytree.familytreemaker -a "王灿文" -v2 -o LouisXIVfamily.dot LouisXIVfamily.txt && \
    dot -Tsvg -o LouisXIVfamily.svg LouisXIVfamily.dot

It will generate the tree from the infos in LouisXIVfamily.txt, starting from 王灿文 and saving the image in LouisXIVfamily.svg.

result: LouisXIVfamily.svg

familytreemaker's People

Contributors

adrienverge avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.