Skip to main content

PyPI version Github All Releases

treetools - tree processing

treetools is a collection of tools for processing treebank trees. It contains algorithms for tree manipulation (such as removal of crossing branches), tree analysis, and grammar extraction.

treetools has been developed at the Department for Computational Linguistics at the Institute for Language and Information at the University of Düsseldorf, Germany (see http://phil.hhu.de/beyond-cfg). The project is sponsored by Deutsche Forschungsgemeinschaft (DFG). It is maintained by Wolfgang Maier.

Author: Wolfgang Maier mailto:maierw@hhu.de. Contributions: Kilian Gebhardt

Installation

Requirements:

  • Python 3.11+

From PyPI

To install the latest release from the Python package index, type::

pip install treetools

Development Installation

To set up a development environment, first install uv. On macOS with Homebrew::

brew install uv

Or using pip::

pip install uv

Then clone the repository and sync dependencies::

git clone https://github.com/wmaier/treetools.git
cd treetools
uv sync

Running

Syntax

To run treetools, type::

treetools-cli [subcommand] [parameters] [options]

Available subcommands are:

  • transform: Process treebank trees. Run transformations and convert between different formats.
  • grammar: Extract grammars for different parsers from treebanks.
  • treeanalysis: Analyze certain properties of treebank trees, such as, e.g., gap degree.
  • transitions: Extract transition sequences as used by transition-based parsers.

To get see the available parameters for a subcommand, type::

treetools-cli [subcommand] --help

To get verbose help on available transformation algorithms, available options, etc., type::

treetools-cli [subcommand] --usage

Examples

To attach the punctuation in TIGER and remove its crossing branches while converting it from TigerXML to the export format, type::

treetools-cli transform tiger.xml tiger.continuous.export --trans root_attach negra_mark_heads boyd_split raising --src-format tigerxml --dest-format export

To extract the bare sentences (one per line) from a treebank in bracketed format, such as the Penn Treebank, type::

treetools-cli transform treebank.brackets treebank.terminals --src-format brackets --dest-format terminals

To delete the traces and co-indexation from the Penn Treebank, type::

treetools-cli transform ptb ptb.notrace --transform ptb_transform --src-format brackets --dest-format brackets

To extract an left-to-right binarized LCFRS with v1/h2 markovization in rparse format from an export-format treebank, type::

treetools-cli grammar input_treebank output_grammar leftright --dest-format rcg --markov v:1 h:2

Development

Running Tests

To run tests with the development environment, type::

uv run pytest

Installing New Packages

To add a new package to your development environment, type::

uv add <package-name>

For development-only dependencies (like testing tools), use::

uv add --dev <package-name>

This will update both pyproject.toml and uv.lock automatically.

License

The code is released under the GNU General Public Licence (GPL) 3.0 or higher. The license texts can be found at at http://www.gnu.org/licenses/gpl-3.0.

Metadata

Release files for treetools 1.0.2

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

Source distribution (sdist)

Source distribution for treetools 1.0.2
File Size Uploaded
treetools-1.0.2.tar.gz 60.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for treetools 1.0.2
File Interpreter ABI Platform
treetools-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 116.7 kB

Release files / treetools-1.0.2.tar.gz

Download URL treetools-1.0.2.tar.gz
Size 60.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cdec3a88f442790a8beb87eda5474311c6ad2056f2bab08febec42e7fb4325d3
BLAKE2b-256 checksum
How to use checksums
9030389f6dc05ba3eb5ab9ea66e71c47341e4bbba54bc11294a3a2785bf73a1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.1

Release files / treetools-1.0.2-py3-none-any.whl

Download URL treetools-1.0.2-py3-none-any.whl
Size 56.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8dade94f092d37b5ae3d791493955e578c8f87c4e8bdab0d4cc82e3b5d5330b1
BLAKE2b-256 checksum
How to use checksums
ef41d47ac7bf00d80c6d9c602e3f18dce758fa38f6d878f06898897b2b315f49
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.1

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

1 release file

0.1.0

1 release file

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