Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Ginger

Format conversion and graphical representation of Universal Dependencies trees.

2d graphical representation

│
│          ┌─────────────┐
│┌────────┐│             │
││        ││             │┌─────────┐    ┌────┐
││    ┌───│┤         ┌───│┤         │┌──┐│    │
↓│    ↓   ↓│         ↓   ↓│         ↓│  ↓│    ↓
ROOT  Je  reconnais  l'  existence  du  kiwi  .

Installation

Dependencies

Ginger depends on

If Python 3 is installed, installing ginger through pip (see below) should take care of most dependencies, except for cairo. Additionally, libginger and libtreebank have no dependencies beyond Python's standard library and can be used independently.

Installing ginger

You don't actually need to install anything if you satisfy the dependencies above, running python3 ginger.py should just work.

However, if you want to have it installed at global level to get the ginger command in your path

  1. Grab the latest release from Github
  2. Unpack it and open a terminal inside the resulting folder
  3. Run python3 -m pip install .

You can also install it directly from the tip (unstable but usually safe) of the master branch whith

python3 -m pip install git+https://github.com/LoicGrobol/ginger/

Test if everything works by running ginger examples/test.conll. The output should be the same as the ASCII-art tree above.

Usage

ginger [--from <format>] <in-file> [--to] [<out-file>]

Arguments

  • <in-file> input file (in CoNLL-U format), - for standard input
  • <out-file> output file, - for standard input (default: -)

Options

  • -f, --from <format> input file format, see below (default: guess)
  • -t, --to <format> output file format, see below (default: ascii)
  • -h, --help Get some help

Examples

  • Print to stdout
ginger examples/test.conll
  • Assume CoNLL-X for input format
ginger -f conllx spam.conllx
  • Output TikZ code
ginger examples/test.conll -t tikz
  • Print to a file
ginger examples/test.conll examples/output.asciiart
  • Pipe in and out
cat examples/test.conll | ginger - | less
  • Get help
ginger --help

Input formats

  • guess Try to guess the file format, defaults to CoNLL-U

CoNLL

  • conllu CoNLL-U v2 format
  • conllx CoNLL-X format
  • conll2009_gold CoNLL-2009 format
    • Takes only the gold columns into account.
    • The P- and -PRED attributes are preserved in the misc attribute of the intermediate CoNLL-U tree.
  • conll2009_sys CoNLL-2009 format
    • Takes only the predicted columns into account.
    • The gold columns and the -PRED attributes are preserved in the misc attribute of the intermediate CoNLL-U tree.

Software

Formats used by mainstream NLP tools

  • talismane Outputs of Talismane
  • mate_gold Input/Output of mate-tools (actually an alias for conll2009_gold)
  • mate_sys Input/Output of mate-tools (actually an alias for conll2009_sys)

Output formats

Treebanks

The input must be either the path to an existing file or - for standard input. The data that it contains must be in one of the following formats:

Note : no real effort is made to preserve informations that are not relevant to Universal Dependencies, so this might be information-destructive, e.g. if converting from CoNLL-2009 to itself, the P- attributes will be dropped.

Text formats

To use these formats, the output destination must be either a file and thus must not be the path to an existing directory, or - for the standard output.

  • ascii ASCII-art (using unicode characters, because, yes, we are subversive)
  • tikz TikZ code. Use the positioning, calc and shapes.multipart tikz libraries
    • The output is only the \tikzpicture part, not a whole compilable document, there is an example of such a document in example.
    • The code is quite verbose since we chose to rely on TikZ' own arithmetic capabilities in order to allow easier edition and reuse of the generated code.

Image formats

To use these formats, the output destination must be either a directory and thus must not be the path of an existing file, or - for the standard output, in which case the byte streams corresponding to different trees will be separated by NULL bytes.

  • png
  • svg
  • pdf

Development

Development and releases on Github.

Further notes

  • When importing non-CoNLL-U treebanks, node forms with spaces are considered to be fixed expressions, and are treated according to UD guidelines by splitting them in single-token nodes linked by fixed dependencies This mean that the exceptions mentioned in the UDv2 guidelines are not supported for those imports. They are supported when importing from CoNLL-U, though.

License

This licence (the so-called “MIT License”) applies to all the files in this repository. See also LICENSE.md.

Copyright 2018 Loïc Grobol <loic.grobol@gmail.com>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
associated documentation files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge, publish, distribute,
sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or
substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for gingertree 0.13.4.dev20190903

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gingertree 0.13.4.dev20190903
File Size Uploaded Provenance Actions
gingertree-0.13.4.dev20190903.tar.gz 21.8 kB Without provenance Details for gingertree-0.13.4.dev20190903.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gingertree 0.13.4.dev20190903
File Interpreter ABI Platform Actions
gingertree-0.13.4.dev20190903-py3-none-any.whl Python 3 none any Details for gingertree-0.13.4.dev20190903-py3-none-any.whl

Total release size: 43.6 kB

Release files / gingertree-0.13.4.dev20190903.tar.gz

Download URL gingertree-0.13.4.dev20190903.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ee307b3036904ab534e88f6db5bfd3a0c7be027fc568bdf7bbf8009a2dc618a5
BLAKE2b-256 checksum
How to use checksums
72466eef8a320dc636aba1f2e37caf5ef64132e501871d6cc39987cddfa216ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Release files / gingertree-0.13.4.dev20190903-py3-none-any.whl

Download URL gingertree-0.13.4.dev20190903-py3-none-any.whl
Size 21.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a8c45051b7e0f5a0cca809e6c5f12854cf64c8acdd67e2e1dc8be2a7ef69c3fe
BLAKE2b-256 checksum
How to use checksums
3702f68b7dd9ba5594118de725d7e31303314bda81a41ecc9e7e0119bfa777fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.3

Security for gingertree 0.13.4.dev20190903

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page