ud-compatibility
Utility for converting Universal Dependencies–annotated corpora to UniMorph
The Universal Dependencies (UD) and Universal Morphology (UniMorph) projects each present schemata for annotating the morphosyntactic details of a language. Each project also provides corpora of annotated text in many languages—UD at the token level and UniMorph at the type level. As each corpus is built by different annotators, language-specific decisions hinder the goal of universal schemata. To ease this interoperability, we present a deterministic mapping from Universal Dependencies v2 features into the UniMorph schema.
Prerequisites
- termcolor:
pip install termcolor - Python 3.5 or later; Anaconda is a simple way to install it.
Usage
The driver of the entire endeavor is the file marry.py, which marries a UD dataset to its affiliated UniMorph.
Conversion
To convert one file to UniMorph, give the path (and optionally the specific language converter you'd like to use).
python marry.py convert --ud my/ud/path/rw-ud-dev.conllu
python marry.py convert --ud my/ud/path/da-ud-dev.conllu -l da
To convert your UD dataset to UniMorph, list the languages you'd like to convert:
python marry.py convert --langs he ro de it no_bokmaal
(You'll need to update the paths in paths.py to reflect where your UD (and UniMorph, if evaluating) data are stored.)
When the input looks like this:
# sent_id = es-train-001-s21
# text = Tiene 2 madres.
1 Tiene tener VERB _ Mood=Ind|Number=Sing|Person=3|Tense=Pres|VerbForm=Fin 0 root _ _
2 2 2 NUM _ NumType=Card 3 nummod _ _
3 madres madre NOUN _ Gender=Masc|Number=Plur 1 obj _ SpaceAfter=No
4 . . PUNCT _ _ 1 punct _ _
The output will look like this:
# sent_id = es-train-001-s21
# text = Tiene 2 madres.
1 Tiene tener VERB _ PRS;V;FIN;3;IND;SG 0 root _ _
2 2 2 NUM _ NUM 3 nummod _ _
3 madres madre NOUN _ N;PL;MASC 1 obj _ SpaceAfter=No
4 . . PUNCT _ _ 1 punct _ _
Evaluation
To assess a conversion (either of the included Translator objects or your own), the syntax is similar:
python marry.py evaluate --langs he ro de it no_bokmaal
(You'll need to update the paths in paths.py to reflect where your UD (and UniMorph, if evaluating) data are stored.)
Replication
To replicate the experiments from the paper, use:
python marry.py replicate
Data
The individual datasets for Universal Dependencies v2 and UniMorph can be downloaded from their respective projects on GitHub.
Contributing
You're welcome to submit a pull request, harmonizing your UD dataset with the corresponding UniMorph.
- Write your own
Translatorsubclass. - Register it in the
languages.pylist. - Submit the Pull Request.
License
This project is licensed under the GNU GPL v3 license; see the LICENSE.md file for details.
Citation
@InProceedings{mccarthy2018udw,
author = "McCarthy, Arya D.
and Silfverberg, Miikka
and Cotterell, Ryan
and Hulden, Mans
and Yarowsky, David",
title = "Marrying {U}niversal {D}ependencies and {U}niversal {M}orphology",
booktitle = "Proceedings of the Second Workshop on Universal Dependencies (UDW 2018)",
year = "2018",
publisher = "Association for Computational Linguistics",
pages = "91--101",
location = "Brussels, Belgium",
url = "http://aclweb.org/anthology/W18-6011"
}
Metadata
Release files for ud-compatibility 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ud_compatibility-0.1.2.tar.gz | 28.3 kB | Without provenance | Details for ud_compatibility-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ud_compatibility-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for ud_compatibility-0.1.2-py3-none-any.whl |
Total release size: 54.8 kB
Release files / ud_compatibility-0.1.2.tar.gz
| Download URL | ud_compatibility-0.1.2.tar.gz |
|---|---|
| Size | 28.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6833884bfb08cd4ad75fd03931e6c657d080b4aa1dfe21a939eff297b3e4e88a
|
|
BLAKE2b-256 checksum How to use checksums |
7adf3ede95342d5641fad4dcca412093d2129650aed270265534147586e44c6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / ud_compatibility-0.1.2-py3-none-any.whl
| Download URL | ud_compatibility-0.1.2-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a5632ed7edeb0e735a62a0e4943464b567837d93e81d877c062d53054b92914
|
|
BLAKE2b-256 checksum How to use checksums |
328370f4873a17fedd2603cfd0a681483d8494cbf4ee77ef806654318be2a340
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for ud-compatibility 0.1.2
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.