File size: 14,324 Bytes
6b815a0
1dc014e
dbcc484
57311d3
6b815a0
 
 
 
 
 
 
 
8eb92fa
6b815a0
 
 
9777a48
6b815a0
 
 
0459444
6b815a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61bf9c9
 
6b815a0
 
 
 
 
0947d65
6b815a0
 
61bf9c9
6b815a0
c420a38
8eb92fa
dad99db
8eb92fa
c420a38
6b815a0
 
c420a38
 
6b815a0
c420a38
 
 
dad99db
6b815a0
 
 
c420a38
d0de5f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b815a0
 
 
dbcc484
 
6b815a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4ecfa14
 
8aa4cab
6b815a0
422c543
 
6b815a0
 
 
c6f3815
6b815a0
422c543
 
 
dbcc484
 
07a166d
 
 
 
 
 
 
 
dbcc484
 
 
 
 
 
 
f85a1e1
dbcc484
 
 
 
 
 
 
d0de5f4
dbcc484
 
 
 
 
 
 
c420a38
 
 
dbcc484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b815a0
 
 
 
 
 
f397248
 
 
 
 
 
2d7c7ac
 
f397248
6b815a0
 
d0de5f4
94dbda3
d0de5f4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94dbda3
 
d0de5f4
 
 
 
 
 
 
 
 
c420a38
 
d0de5f4
c420a38
 
d0de5f4
 
 
c420a38
d0de5f4
 
 
94dbda3
6b815a0
 
 
d0de5f4
 
c420a38
d0de5f4
 
 
 
 
 
 
 
 
 
 
 
 
 
c420a38
 
d0de5f4
 
 
 
 
 
 
 
 
 
 
c420a38
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d0de5f4
 
 
 
 
 
 
 
 
 
 
 
c420a38
 
d0de5f4
6b815a0
 
 
c420a38
 
 
 
 
 
 
 
 
 
 
 
 
6b815a0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80561d7
 
 
 
 
 
e2ac58e
6b815a0
0459444
6b815a0
 
 
3119c5b
 
 
 
6b815a0
 
422c543
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
---
### THIS IS A GENERATED FILE.
viewer: true

annotations_creators:
- expert-generated

language_creators:
- crowdsourced

language:
{%- set languages = [] -%}
{%- for name,metadata in data.items()|sort(attribute='1.dirname') -%}
    {{ languages.append(metadata.lcode)|default("", True)}}
{%- endfor -%}
{%- for language in languages|unique %}
- {{ language if language != 'no' else "'no'" }}
{%- endfor %}

license:
- apache-2.0

multilinguality:
- multilingual

size_categories:
- '1K<n<10K'

source_datasets:
- original

task_categories:
- token-classification

task_ids:
- parsing
- part-of-speech
- lemmatization

paperswithcode_id: universal-dependencies
pretty_name: Universal Dependencies Treebank

tags:
- text
- constituency-parsing
- dependency-parsing
- part-of-speech-tagging

configs:
{%- for name,metadata in data.items()|sort(attribute='1.dirname') %}
{%- if not metadata.blocked %}
- config_name: {{ name }}
  data_files:
  {%- set ns = namespace(dataset_size=0) -%}
  {%- for fileset_split_name,fileset_split_data in metadata.splits.items() %}
  - split: {{ fileset_split_name }}
    path: parquet/{{ name }}/{{ fileset_split_name }}.parquet
  {%- endfor %}
  {%- if name == 'en_ewt' %}
  default: true
  {%- endif %}
{%- endif %}
{%- endfor %}
---

## Dataset Card (v2.0) for Universal Dependencies Treebank

**Version 2.0.0** introduces significant improvements and breaking changes:
- **Parquet Format:** faster loading with HuggingFace datasets >=4.0.0
- **MWT Support:** New `mwt` field provides structured multi-word token information
- **Enhanced Security:** No more `trust_remote_code=True` required
- **Separate Versioning:** Loader version (2.0.0) distinct from UD data version (2.17)

**Breaking Changes:**
- Token sequences now exclude MWT surface forms (matches UD guidelines)
- Requires `datasets>=4.0.0` for Parquet support

- **Migration Guide:** See [MIGRATION.md](MIGRATION.md) for detailed upgrade instructions
- **Changelog:** See [CHANGELOG.md](CHANGELOG.md) for complete release notes


## Table of Contents
- [Dataset Description](#dataset-description)
  - [Dataset Summary](#dataset-summary)
  - [Data Quality & Fidelity](#data-quality--fidelity)
  - [Usage](#usage)
  - [Supported Tasks and Leaderboards](#supported-tasks-and-leaderboards)
- [Dataset Structure](#dataset-structure)
  - [Data Instances](#data-instances)
  - [Data Fields](#data-fields)
  - [Data Splits](#data-splits)
- [Dataset Creation](#dataset-creation)
  - [Curation Rationale](#curation-rationale)
  - [Source Data](#source-data)
  - [Annotations](#annotations)
  - [Personal and Sensitive Information](#personal-and-sensitive-information)
- [Considerations for Using the Data](#considerations-for-using-the-data)
  - [Social Impact of Dataset](#social-impact-of-dataset)
  - [Discussion of Biases](#discussion-of-biases)
  - [Other Known Limitations](#other-known-limitations)
- [Additional Information](#additional-information)
  - [Dataset Curators](#dataset-curators)
  - [Licensing Information](#licensing-information)
  - [Citation Information](#citation-information)
  - [Contributions](#contributions)

## Dataset Description

- **Homepage:** [Universal Dependencies](https://universaldependencies.org)
- **Repository:** [Universal Dependencies](https://github.com/UniversalDependencies)
- **Paper:** [Universal Dependencies v2: An Evergrowing Multilingual Treebank Collection](https://arxiv.org/abs/2004.10643)
- **Leaderboard:**
- **Point of Contact:** [appliedlinguisticsdevs@eurac.edu](mailto:appliedlinguisticsdevs@eurac.edu)
- **Point of Contact:** [IAL Homepage](https://www.eurac.edu/linguistics)

### Dataset Summary

{{ description }}

This is a (temporary) fork of
[/universal-dependencies/universal_dependencies](https://huggingface.co/datasets/universal-dependencies/universal_dependencies).

### Data Quality & Fidelity

This dataset achieves **100% fidelity** for linguistic data (tokens,
annotations, dependencies) and **very high (~98%) fidelity** for metadata. The
Parquet files can be perfectly reconstructed back to the original CoNLL-U
format with:
- All linguistic annotations preserved exactly
- Multi-word tokens (MWTs) and empty nodes fully supported
- Duplicate metadata keys preserved (1,323 sentences across 14 treebanks)
- Enhanced dependencies and rare annotation edge cases handled correctly

Recent improvements include fixes for:
- Double equals parsing in FEATS/MISC fields (e.g., `Gloss==POSS`)
- Empty nodes with ID < 1 (e.g., `0.1` for pro-drop subjects)
- Empty metadata values and keys without values
- Raw field parsing to bypass library bugs

For technical details, see [CONLLU_PARSING.md](https://github.com/bot-zen/ud-hf-parquet-tools/blob/main/CONLLU_PARSING.md) in the ud-hf-parquet-tools repository.

### Usage

```python
from datasets import load_dataset

# Load a specific treebank
ds = load_dataset("commul/universal_dependencies", "en_ewt", revision="{{ ud_ver }}", split="train")

# Access sentence data
sentence = ds[0]
print(f"Sentence ID: {sentence['sent_id']}")
print(f"Text: {sentence['text']}")
print(f"Tokens: {sentence['tokens']}")

## TODO: Make helper functions available  
## post v2.0 universal_dependencies.py is not part of the Dataset any longer!
##
# Parse optional fields using helper functions
from universal_dependencies import parse_feats, parse_misc

for i, token in enumerate(sentence['tokens']):
    feats = parse_feats(sentence['feats'][i])  # Returns dict or {}
    misc = parse_misc(sentence['misc'][i])      # Returns dict or {}
    print(f"{token}: UPOS={sentence['upos'][i]}, feats={feats}, misc={misc}")

# Export back to CoNLL-U format
from universal_dependencies import write_conllu

# Write to stdout
write_conllu(ds)

# Write to file
write_conllu(ds, "output.conllu")

# Write to buffer (for other libraries)
import io
buffer = io.StringIO()
write_conllu(ds, buffer)
conllu_text = buffer.getvalue()
```

### Supported Tasks and Leaderboards

[More Information Needed]

## Dataset Structure

All files use a revised version of [the CoNLL-X
format](http://anthology.aclweb.org/W/W06/W06-2920.pdf) called CoNLL-U.
Annotations are encoded in plain text files (UTF-8, [normalized to
NFC](http://unicode.org/reports/tr15/), using only the LF character as line
break, including an LF character at the end of file).

* [Revision (r{{ ud_ver }}) specific documentation](https://github.com/UniversalDependencies/docs/blob/r{{ ud_ver }}/format.md)
* [Latest UD CoNLL-U Format documentation](https://universaldependencies.org/format.html)

### Data Instances

This dataset has {{ data.items()|length }} configurations (treebanks).
```python
from datasets import get_dataset_config_names, load_dataset

# Get all available treebank configurations for revision="{{ ud_ver }}"
configs = get_dataset_config_names("commul/universal_dependencies", revision="{{ ud_ver }}")
print(f"Available treebanks: {len(configs)}")

# Example configurations:
# ['af_afribooms',
#  'akk_pisandub',
#  'aqz_tudet',
#  'sq_tsa',
#  'gsw_uzh',
#  'am_att',
#   ...
# ]

# Get the latest configurations
get_dataset_config_names("commul/universal_dependencies")

# Load a specific treebank
dataset = load_dataset("commul/universal_dependencies", "en_ewt")
print(dataset)

# Output:
# DatasetDict({
#     train: Dataset({
#         features: ['sent_id', 'text', 'comments', 'tokens', 'lemmas', 'upos', 'xpos', 'feats', 'head', 'deprel', 'deps', 'misc', 'mwt', 'empty_nodes'],
#         num_rows: 12544
#     })
#     dev: Dataset({
#         features: ['sent_id', 'text', 'comments', 'tokens', 'lemmas', 'upos', 'xpos', 'feats', 'head', 'deprel', 'deps', 'misc', 'mwt', 'empty_nodes'],
#         num_rows: 2001
#     })
#     test: Dataset({
#         features: ['sent_id', 'text', 'comments', 'tokens', 'lemmas', 'upos', 'xpos', 'feats', 'head', 'deprel', 'deps', 'misc', 'mwt', 'empty_nodes'],
#         num_rows: 2077
#     })
# })
```

### Data Fields

Each example in the dataset contains the following fields:

- **sent_id** (string): Sentence ID from the CoNLL-U file metadata
- **text** (string): Full sentence text (surface form)
- **tokens** (list of strings): Syntactic word forms (MWT surface forms excluded)
- **lemmas** (list of strings): Lemmas for each syntactic word
- **upos** (list of strings): Universal POS tags
- **xpos** (list of strings): Language-specific POS tags
- **feats** (list of strings): Morphological features in UD format
- **head** (list of strings): Head indices for dependency relations
- **deprel** (list of strings): Dependency relation labels
- **deps** (list of strings): Enhanced dependency graph
- **misc** (list of strings): Miscellaneous annotations
- **mwt** (list of dicts): Multi-Word Token information (NEW in v2.0)
  - **id** (string): Token range (e.g., "1-2")
  - **form** (string): Surface form (e.g., "don't")
  - **misc** (string): MWT-specific metadata
- **empty_nodes** (list of dicts): Empty Node Token information (NEW in v2.0)
- **comments** (list of strings): All comments including duplicates, empty values, and original ordering (NEW in v2.0)

**Example:**

```python
from datasets import load_dataset

dataset = load_dataset("commul/universal_dependencies", "en_ewt", split="train")
print(dataset[0])

# Output:
{
    'sent_id': 'weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-0001',
    'text': 'Al-Zaman : American forces killed Shaikh Abdullah al-Ani, the preacher at the mosque in the town of Qaim, near the Syrian border.',
    'comments': [
        'newdoc id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000',
        '__SENT_ID__',
        'newpar id = weblog-juancole.com_juancole_20051126063000_ENG_20051126_063000-p0001',
        '__TEXT__'
    ],
    'tokens': ['Al', '-', 'Zaman', ':', 'American', 'forces', 'killed', 'Shaikh', 'Abdullah', 'al', '-', 'Ani', ',', 'the', 'preacher', 'at', 'the', 'mosque', 'in', 'the', 'town', 'of', 'Qaim', ',', 'near', 'the', 'Syrian', 'border', '.'],
    'lemmas': ['Al', '-', 'Zaman', ':', 'American', 'force', 'kill', 'Shaikh', 'Abdullah', 'al', '-', 'Ani', ',', 'the', 'preacher', 'at', 'the', 'mosque', 'in', 'the', 'town', 'of', 'Qaim', ',', 'near', 'the', 'Syrian', 'border', '.'],
    'upos': [10, 1, 10, 1, 6, 0, 16, 10, 10, 10, 1, 10, 1, 8, 0, 2, 8, 0, 2, 8, 0, 2, 10, 1, 2, 8, 6, 0, 1],
    'xpos': ['NNP', 'HYPH', 'NNP', ':', 'JJ', 'NNS', 'VBD', 'NNP', 'NNP', 'NNP', 'HYPH', 'NNP', ',', 'DT', 'NN', 'IN', 'DT', 'NN', 'IN', 'DT', 'NN', 'IN', 'NNP', ',', 'IN', 'DT', 'JJ', 'NN', '.'],
    'feats': ['Number=Sing', None, 'Number=Sing', None, 'Degree=Pos', 'Number=Plur', 'Mood=Ind|Number=Plur|Person=3|Tense=Past|VerbForm=Fin', 'Number=Sing', 'Number=Sing', 'Number=Sing', None, 'Number=Sing', None, 'Definite=Def|PronType=Art', 'Number=Sing', None, 'Definite=Def|PronType=Art', 'Number=Sing', None, 'Definite=Def|PronType=Art', 'Number=Sing', None, 'Number=Sing', None, None, 'Definite=Def|PronType=Art', 'Degree=Pos', 'Number=Sing', None], 
    'head': ['0', '3', '1', '7', '6', '7', '1', '7', '8', '8', '12', '8', '15', '15', '8', '18', '18', '15', '21', '21', '18', '23', '21', '28', '28', '28', '28', '21', '1'],
    'deprel': ['root', 'punct', 'flat', 'punct', 'amod', 'nsubj', 'parataxis', 'obj', 'flat', 'flat', 'punct', 'flat', 'punct', 'det', 'appos', 'case', 'det', 'nmod', 'case', 'det', 'nmod', 'case', 'nmod', 'punct', 'case', 'det', 'amod', 'nmod', 'punct'], 
    'deps': ['0:root', '3:punct', '1:flat', '7:punct', '6:amod', '7:nsubj', '1:parataxis', '7:obj', '8:flat', '8:flat', '12:punct', '8:flat', '15:punct', '15:det', '8:appos', '18:case', '18:det', '15:nmod:at', '21:case', '21:det', '18:nmod:in', '23:case', '21:nmod:of', '28:punct', '28:case', '28:det', '28:amod', '21:nmod:near', '1:punct'], 
    'misc': ['SpaceAfter=No', 'SpaceAfter=No', None, None, None, None, None, None, None, 'SpaceAfter=No', 'SpaceAfter=No', 'SpaceAfter=No', None, None, None, None, None, None, None, None, None, None, 'SpaceAfter=No', None, None, None, None, 'SpaceAfter=No', None], 
    'mwt': [],
    'empty_nodes': []
}
```

*MWT Example (French):**

```python
dataset = load_dataset("commul/universal_dependencies", "fr_gsd", split="train")
# Find sentence with MWT
example = [ex for ex in dataset if ex['mwt']][0]
print(example['mwt'])

# Output:
[{'id': '8-9', 'form': 'des', 'feats': None, 'misc': None}]
# This means example['tokens'][7:9] = ['de', 'les'] are combined as MWT surface form "des"
```

### Data Splits

The file `metadata.json` stores additional information about the data, for example, available splits:

```python
from huggingface_hub import hf_hub_download
import json

md = hf_hub_download(repo_id="commul/universal_dependencies", filename="metadata.json", repo_type="dataset")

with open(md, "r", encoding="utf-8") as f:
    metadata = json.load(f)

[metadata[key]['splits'].keys() for key in metadata]
```

## Dataset Creation

### Curation Rationale

[More Information Needed]

### Source Data

#### Initial Data Collection and Normalization

[More Information Needed]

#### Who are the source language producers?

[More Information Needed]

### Annotations

#### Annotation process

[More Information Needed]

#### Who are the annotators?

[More Information Needed]

### Personal and Sensitive Information

[More Information Needed]

## Considerations for Using the Data

### Social Impact of Dataset

[More Information Needed]

### Discussion of Biases

[More Information Needed]

### Other Known Limitations

[More Information Needed]

## Additional Information

### Dataset Curators

[More Information Needed]

### Licensing Information
Universal Dependencies is a collection of linguistic data and tools. Each of
the treebanks has its own license terms and you (the "User") are responsible
for complying with the license terms applicable to those parts of UD which you
use.

Details about the License Terms:
* https://lindat.mff.cuni.cz/repository/xmlui/page/license-ud-{{ ud_ver }}

The `./tools/` are licensed under the [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0) license.

### Citation Information

```bibtex
{{ citation }}
```

### Contributions

Thanks to [universal-dependencies](https://huggingface.co/universal-dependencies) for [the original of this dataset](https://huggingface.co/datasets/universal-dependencies/universal_dependencies).