Convert Universal Dependencies parses into constituency representations.
Project description
dep2con
dep2con converts Universal Dependencies (UD) parses into constituency
representations. It accepts either a CoNLL-U file or text processed with the
Stanza dependency parser.
Requirements
- Python 3.14 or newer
pyconll4.0 or newer for CoNLL-U inputstanzawhen parsing raw text
Installation
Install the published package:
python -m pip install dep2con
For development from a clone:
python -m pip install -e ".[dev]"
Usage
from dep2con import make_const
results = make_const("input.conllu")
for dep2con in results:
print(dep2con.sent_parse)
print(dep2con.sent_text)
print(dep2con.x_phrases)
make_const() returns a list with one Dep2Con object per input sentence.
Each result has these attributes:
sent_parsex_phrasessent_dictsent_textsent_lensentence_indexsource
To parse raw text instead of loading CoNLL-U:
results = make_const("Cats sleep.", lang="en", use_parser=True)
Development
Run the test suite:
python -m pytest
Build distributable files:
python -m build
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dep2con-0.2.0.tar.gz.
File metadata
- Download URL: dep2con-0.2.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8399b32485ce2d94a2f189cd2b4caf905420ba95db8a0d9e243c3c08b2e13705
|
|
| MD5 |
c3bc232158560c33f44d2241aa28f186
|
|
| BLAKE2b-256 |
705f0f7c7678d90dc18411422d1586be4fe3450848e8239a4eb9f445fcc8d18e
|
File details
Details for the file dep2con-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dep2con-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ed3a2ae26f12a2b9b40477f3313e0bf2fa89662c22bccaecd7ae9255a355583
|
|
| MD5 |
4f9f09cfa54a1db72708c93b954760b2
|
|
| BLAKE2b-256 |
38938109c8288193a7638f5ae4864a47a4315e2dadd04e1ee92eb479f0af1a1f
|