system HF staff commited on
Commit
d3c9e97
0 Parent(s):

Update files from the datasets library (from 1.2.0)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.2.0

Files changed (5) hide show
  1. .gitattributes +27 -0
  2. README.md +562 -0
  3. dataset_infos.json +1 -0
  4. dummy/0.0.0/dummy_data.zip +3 -0
  5. udhr.py +92 -0
.gitattributes ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.model filter=lfs diff=lfs merge=lfs -text
12
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
13
+ *.onnx filter=lfs diff=lfs merge=lfs -text
14
+ *.ot filter=lfs diff=lfs merge=lfs -text
15
+ *.parquet filter=lfs diff=lfs merge=lfs -text
16
+ *.pb filter=lfs diff=lfs merge=lfs -text
17
+ *.pt filter=lfs diff=lfs merge=lfs -text
18
+ *.pth filter=lfs diff=lfs merge=lfs -text
19
+ *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
21
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
22
+ *.tflite filter=lfs diff=lfs merge=lfs -text
23
+ *.tgz filter=lfs diff=lfs merge=lfs -text
24
+ *.xz filter=lfs diff=lfs merge=lfs -text
25
+ *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,562 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ annotations_creators:
3
+ - no-annotation
4
+ language_creators:
5
+ - found
6
+ languages:
7
+ - aa
8
+ - ab
9
+ - ace
10
+ - acu
11
+ - ada
12
+ - ady
13
+ - af
14
+ - agr
15
+ - aii
16
+ - ajg
17
+ - als
18
+ - alt
19
+ - am
20
+ - amc
21
+ - ame
22
+ - ami
23
+ - amr
24
+ - arb
25
+ - arl
26
+ - arn
27
+ - ast
28
+ - auc
29
+ - ayr
30
+ - azj
31
+ - ban
32
+ - bax
33
+ - bba
34
+ - bci
35
+ - bcl
36
+ - be
37
+ - bem
38
+ - bfa
39
+ - bg
40
+ - bho
41
+ - bi
42
+ - bin
43
+ - blt
44
+ - bm
45
+ - bn
46
+ - bo
47
+ - boa
48
+ - br
49
+ - bs
50
+ - buc
51
+ - bug
52
+ - bum
53
+ - ca
54
+ - cab
55
+ - cak
56
+ - cbi
57
+ - cbr
58
+ - cbs
59
+ - cbt
60
+ - cbu
61
+ - ccp
62
+ - ceb
63
+ - cfm
64
+ - ch
65
+ - chj
66
+ - chk
67
+ - chr
68
+ - cic
69
+ - cjk
70
+ - cjs
71
+ - cjy
72
+ - ckb
73
+ - cmn
74
+ - cnh
75
+ - cni
76
+ - co
77
+ - cof
78
+ - cot
79
+ - cpu
80
+ - crh
81
+ - cri
82
+ - crs
83
+ - cs
84
+ - csa
85
+ - csw
86
+ - ctd
87
+ - cy
88
+ - da
89
+ - dag
90
+ - ddn
91
+ - de
92
+ - dga
93
+ - dip
94
+ - duu
95
+ - dv
96
+ - dyo
97
+ - dyu
98
+ - dz
99
+ - ee
100
+ - ekk
101
+ - el
102
+ - emk
103
+ - en
104
+ - eo
105
+ - es
106
+ - ese
107
+ - eu
108
+ - eve
109
+ - evn
110
+ - fat
111
+ - fi
112
+ - fj
113
+ - fkv
114
+ - fo
115
+ - fon
116
+ - fr
117
+ - fuf
118
+ - fur
119
+ - fuv
120
+ - fy
121
+ - ga
122
+ - gaa
123
+ - gag
124
+ - gan
125
+ - gaz
126
+ - gd
127
+ - gjn
128
+ - gkp
129
+ - gl
130
+ - gld
131
+ - gu
132
+ - guc
133
+ - gug
134
+ - guu
135
+ - gv
136
+ - gyr
137
+ - ha
138
+ - hak
139
+ - haw
140
+ - he
141
+ - hea
142
+ - hi
143
+ - hil
144
+ - hlt
145
+ - hms
146
+ - hna
147
+ - hni
148
+ - hnj
149
+ - hns
150
+ - hr
151
+ - hsb
152
+ - ht
153
+ - hu
154
+ - hus
155
+ - huu
156
+ - hy
157
+ - ia
158
+ - ibb
159
+ - id
160
+ - ig
161
+ - ii
162
+ - ike
163
+ - ilo
164
+ - io
165
+ - is
166
+ - it
167
+ - ja
168
+ - jiv
169
+ - jv
170
+ - ka
171
+ - kbd
172
+ - kbp
173
+ - kde
174
+ - kdh
175
+ - kea
176
+ - kek
177
+ - kha
178
+ - khk
179
+ - kjh
180
+ - kk
181
+ - kkh
182
+ - kl
183
+ - km
184
+ - kmb
185
+ - kmr
186
+ - kn
187
+ - knc
188
+ - kng
189
+ - ko
190
+ - koi
191
+ - koo
192
+ - kqn
193
+ - kqs
194
+ - kri
195
+ - krl
196
+ - ktu
197
+ - kwi
198
+ - ky
199
+ - la
200
+ - lad
201
+ - lb
202
+ - lg
203
+ - lia
204
+ - lij
205
+ - lld
206
+ - ln
207
+ - lns
208
+ - lo
209
+ - lob
210
+ - lot
211
+ - loz
212
+ - lt
213
+ - lua
214
+ - lue
215
+ - lun
216
+ - lus
217
+ - lvs
218
+ - mad
219
+ - mag
220
+ - mai
221
+ - mam
222
+ - maz
223
+ - mcd
224
+ - mcf
225
+ - men
226
+ - mfq
227
+ - mh
228
+ - mi
229
+ - mic
230
+ - min
231
+ - miq
232
+ - mk
233
+ - ml
234
+ - mnw
235
+ - mos
236
+ - mr
237
+ - mt
238
+ - mto
239
+ - mxi
240
+ - mxv
241
+ - my
242
+ - mzi
243
+ - nan
244
+ - nb
245
+ - nba
246
+ - nds
247
+ - ng
248
+ - nhn
249
+ - nio
250
+ - niu
251
+ - njo
252
+ - nku
253
+ - nl
254
+ - nn
255
+ - not
256
+ - npi
257
+ - nr
258
+ - nso
259
+ - nv
260
+ - ny
261
+ - nym
262
+ - nyn
263
+ - nzi
264
+ - oaa
265
+ - oc
266
+ - ojb
267
+ - oki
268
+ - orh
269
+ - os
270
+ - ote
271
+ - pa
272
+ - pam
273
+ - pap
274
+ - pau
275
+ - pbb
276
+ - pbu
277
+ - pcd
278
+ - pcm
279
+ - pes
280
+ - pis
281
+ - piu
282
+ - pl
283
+ - plt
284
+ - pnb
285
+ - pon
286
+ - pov
287
+ - ppl
288
+ - prq
289
+ - prs
290
+ - pt
291
+ - qu
292
+ - quc
293
+ - qug
294
+ - quh
295
+ - quy
296
+ - quz
297
+ - qva
298
+ - qvc
299
+ - qvh
300
+ - qvm
301
+ - qvn
302
+ - qwh
303
+ - qxn
304
+ - qxu
305
+ - rar
306
+ - rgn
307
+ - rm
308
+ - rmn
309
+ - rn
310
+ - ro
311
+ - ru
312
+ - rup
313
+ - rw
314
+ - sa
315
+ - sah
316
+ - sco
317
+ - se
318
+ - sey
319
+ - sg
320
+ - shk
321
+ - shn
322
+ - shp
323
+ - si
324
+ - sk
325
+ - skr
326
+ - sl
327
+ - sm
328
+ - sn
329
+ - snk
330
+ - snn
331
+ - so
332
+ - sr
333
+ - src
334
+ - srr
335
+ - ss
336
+ - st
337
+ - su
338
+ - suk
339
+ - sus
340
+ - sv
341
+ - swb
342
+ - swh
343
+ - ta
344
+ - taj
345
+ - tbz
346
+ - tca
347
+ - tdt
348
+ - te
349
+ - tem
350
+ - tet
351
+ - tg
352
+ - th
353
+ - ti
354
+ - tiv
355
+ - tk
356
+ - tl
357
+ - tly
358
+ - tn
359
+ - to
360
+ - tob
361
+ - toi
362
+ - toj
363
+ - top
364
+ - tpi
365
+ - tr
366
+ - ts
367
+ - tsz
368
+ - tt
369
+ - tw
370
+ - ty
371
+ - tyv
372
+ - tzh
373
+ - tzm
374
+ - tzo
375
+ - ug
376
+ - uk
377
+ - umb
378
+ - und
379
+ - ur
380
+ - ura
381
+ - uzn
382
+ - vai
383
+ - ve
384
+ - vec
385
+ - vep
386
+ - vi
387
+ - vmw
388
+ - wa
389
+ - war
390
+ - wo
391
+ - wuu
392
+ - wwa
393
+ - xh
394
+ - xsm
395
+ - yad
396
+ - yao
397
+ - yap
398
+ - ydd
399
+ - ykg
400
+ - yo
401
+ - yua
402
+ - yue
403
+ - zam
404
+ - zdj
405
+ - zgh
406
+ - zlm
407
+ - zro
408
+ - ztu
409
+ - zu
410
+ - zyb
411
+ licenses:
412
+ - unknown
413
+ multilinguality:
414
+ - multilingual
415
+ size_categories:
416
+ - n<1K
417
+ source_datasets:
418
+ - original
419
+ task_categories:
420
+ - conditional-text-generation
421
+ task_ids:
422
+ - machine-translation
423
+ ---
424
+
425
+ # Dataset Card for The Universal Declaration of Human Rights (UDHR)
426
+
427
+ ## Table of Contents
428
+ - [Dataset Description](#dataset-description)
429
+ - [Dataset Summary](#dataset-summary)
430
+ - [Supported Tasks](#supported-tasks-and-leaderboards)
431
+ - [Languages](#languages)
432
+ - [Dataset Structure](#dataset-structure)
433
+ - [Data Instances](#data-instances)
434
+ - [Data Fields](#data-instances)
435
+ - [Data Splits](#data-instances)
436
+ - [Dataset Creation](#dataset-creation)
437
+ - [Curation Rationale](#curation-rationale)
438
+ - [Source Data](#source-data)
439
+ - [Annotations](#annotations)
440
+ - [Personal and Sensitive Information](#personal-and-sensitive-information)
441
+ - [Considerations for Using the Data](#considerations-for-using-the-data)
442
+ - [Social Impact of Dataset](#social-impact-of-dataset)
443
+ - [Discussion of Biases](#discussion-of-biases)
444
+ - [Other Known Limitations](#other-known-limitations)
445
+ - [Additional Information](#additional-information)
446
+ - [Dataset Curators](#dataset-curators)
447
+ - [Licensing Information](#licensing-information)
448
+ - [Citation Information](#citation-information)
449
+
450
+ ## Dataset Description
451
+
452
+ - **Homepage:** https://www.ohchr.org/EN/UDHR/Pages/UDHRIndex.aspx, https://unicode.org/udhr/index.html
453
+ - **Repository:**
454
+ - **Paper:**
455
+ - **Leaderboard:**
456
+ - **Point of Contact:**
457
+
458
+ ### Dataset Summary
459
+
460
+ The Universal Declaration of Human Rights (UDHR) is a milestone document in the history of human rights. Drafted by
461
+ representatives with different legal and cultural backgrounds from all regions of the world, it set out, for the
462
+ first time, fundamental human rights to be universally protected. The Declaration was adopted by the UN General
463
+ Assembly in Paris on 10 December 1948 during its 183rd plenary meeting.
464
+
465
+ © 1996 – 2009 The Office of the High Commissioner for Human Rights
466
+
467
+ This plain text version prepared by the “UDHR in Unicode” project, https://www.unicode.org/udhr.
468
+
469
+ ### Supported Tasks and Leaderboards
470
+
471
+ [More Information Needed]
472
+
473
+ ### Languages
474
+
475
+ The dataset includes translations of the document in 467 languages and dialects. The list of languages can be found
476
+ [here](https://unicode.org/udhr/translations.html).
477
+
478
+ ## Dataset Structure
479
+
480
+ ### Data Instances
481
+
482
+ Each instance corresponds to a different language and includes information about the language and the full document
483
+ text.
484
+
485
+ ### Data Fields
486
+
487
+ - `text`: The full document text with each line of text delimitted by a newline (`\n`).
488
+ - `lang_key`: The unique identifier of a given translation.
489
+ - `lang_name`: The textual description of language/dialect.
490
+ - `iso639-3`: The [iso639-3](https://iso639-3.sil.org/) language identifier.
491
+ - `iso15924`: The [iso15924](https://unicode.org/iso15924/iso15924-codes.html) language identifier.
492
+
493
+ ### Data Splits
494
+
495
+ Only a `train` split included which includes the full document in all languages.
496
+
497
+ ## Dataset Creation
498
+
499
+ ### Curation Rationale
500
+
501
+ In addition to its social significance, the document set a world record in 1999 for being the most translated
502
+ document in the world and as such can be useful for settings requiring paired text between many languages.
503
+
504
+ ### Source Data
505
+
506
+ #### Initial Data Collection and Normalization
507
+
508
+ [More Information Needed]
509
+
510
+ #### Who are the source language producers?
511
+
512
+ [More Information Needed]
513
+
514
+ ### Annotations
515
+
516
+ #### Annotation process
517
+
518
+ [More Information Needed]
519
+
520
+ #### Who are the annotators?
521
+
522
+ [More Information Needed]
523
+
524
+ ### Personal and Sensitive Information
525
+
526
+ [More Information Needed]
527
+
528
+ ## Considerations for Using the Data
529
+
530
+ ### Social Impact of Dataset
531
+
532
+ In addition to the social and political significance of the United Nations' Universal Declaration of Human Rights,
533
+ the document set a world record in 1999 for being the most translated document in the world and as such can be useful
534
+ for settings requiring paired text between many languagers including those that are low resource and significantly
535
+ underrepresented in NLP research.
536
+
537
+ ### Discussion of Biases
538
+
539
+ [More Information Needed]
540
+
541
+ ### Other Known Limitations
542
+
543
+ Although the document is translated into a very large number of languages, the text is very short and therefore may
544
+ have limited usefulness for most types of modeling and evaluation.
545
+
546
+ ## Additional Information
547
+
548
+ ### Dataset Curators
549
+
550
+ The txt/xml data files used here were compiled by The Unicode Consortium, which can be found
551
+ [here](https://unicode.org/udhr/index.html). The original texts can be found on the
552
+ [United Nations website](https://www.ohchr.org/EN/UDHR/Pages/UDHRIndex.aspx).
553
+
554
+ ### Licensing Information
555
+
556
+ © 1996 – 2009 The Office of the High Commissioner for Human Rights
557
+
558
+ [More Information Needed]
559
+
560
+ ### Citation Information
561
+
562
+ [More Information Needed]
dataset_infos.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"default": {"description": "The Universal Declaration of Human Rights (UDHR) is a milestone document in the history of human rights. Drafted by\nrepresentatives with different legal and cultural backgrounds from all regions of the world, it set out, for the\nfirst time, fundamental human rights to be universally protected. The Declaration was adopted by the UN General\nAssembly in Paris on 10 December 1948 during its 183rd plenary meeting. The dataset includes translations of the\ndocument in 464 languages and dialects.\n\n\u00a9 1996 \u2013 2009 The Office of the High Commissioner for Human Rights\n\nThis plain text version prepared by the \u201cUDHR in Unicode\u201d project, https://www.unicode.org/udhr.\n", "citation": "", "homepage": "https://www.ohchr.org/EN/UDHR/Pages/UDHRIndex.aspx", "license": "", "features": {"text": {"dtype": "string", "id": null, "_type": "Value"}, "lang_key": {"dtype": "string", "id": null, "_type": "Value"}, "lang_name": {"dtype": "string", "id": null, "_type": "Value"}, "iso639-3": {"dtype": "string", "id": null, "_type": "Value"}, "iso15924": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "builder_name": "udhn", "config_name": "default", "version": {"version_str": "0.0.0", "description": null, "major": 0, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 6453404, "num_examples": 464, "dataset_name": "udhn"}}, "download_checksums": {"https://unicode.org/udhr/assemblies/udhr_xml.zip": {"num_bytes": 2273633, "checksum": "0565fa62c2ff155b84123198bcc967edd8c5eb9679eadc01e6fb44a5cf730fee"}, "https://unicode.org/udhr/assemblies/udhr_txt.zip": {"num_bytes": 2107471, "checksum": "087b474a070dd4096ae3028f9ee0b30dcdcb030cc85a1ca02e143be46327e5e5"}}, "download_size": 4381104, "post_processing_size": null, "dataset_size": 6453404, "size_in_bytes": 10834508}}
dummy/0.0.0/dummy_data.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:19063b07d325e85347e7f9ad82e55a8db619e739784ec6613049ce51d98ced17
3
+ size 11931
udhr.py ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # coding=utf-8
2
+ # Copyright 2020 HuggingFace Datasets Authors.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # Lint as: python3
17
+ """Universal Declaration of Human Rights"""
18
+
19
+ from __future__ import absolute_import, division, print_function
20
+
21
+ import glob
22
+ import os
23
+ import xml.etree.ElementTree as ET
24
+
25
+ import datasets
26
+
27
+
28
+ _DESCRIPTION = """\
29
+ The Universal Declaration of Human Rights (UDHR) is a milestone document in the history of human rights. Drafted by
30
+ representatives with different legal and cultural backgrounds from all regions of the world, it set out, for the
31
+ first time, fundamental human rights to be universally protected. The Declaration was adopted by the UN General
32
+ Assembly in Paris on 10 December 1948 during its 183rd plenary meeting. The dataset includes translations of the
33
+ document in 464 languages and dialects.
34
+
35
+ © 1996 – 2009 The Office of the High Commissioner for Human Rights
36
+
37
+ This plain text version prepared by the “UDHR in Unicode” project, https://www.unicode.org/udhr.
38
+ """
39
+
40
+ _WEBPAGE = "https://www.ohchr.org/EN/UDHR/Pages/UDHRIndex.aspx"
41
+
42
+ # XML for meta-info about language and TXT for text
43
+ _XML_DOWNLOAD_URL = "https://unicode.org/udhr/assemblies/udhr_xml.zip"
44
+ _TXT_DOWNLOAD_URL = "https://unicode.org/udhr/assemblies/udhr_txt.zip"
45
+
46
+
47
+ class UDHN(datasets.GeneratorBasedBuilder):
48
+ """Universal Declaration of Human Rights"""
49
+
50
+ def _info(self):
51
+ return datasets.DatasetInfo(
52
+ description=_DESCRIPTION,
53
+ features=datasets.Features(
54
+ {
55
+ "text": datasets.Value("string"),
56
+ "lang_key": datasets.Value("string"),
57
+ "lang_name": datasets.Value("string"),
58
+ "iso639-3": datasets.Value("string"),
59
+ "iso15924": datasets.Value("string"),
60
+ }
61
+ ),
62
+ homepage=_WEBPAGE,
63
+ )
64
+
65
+ def _split_generators(self, dl_manager):
66
+ xml_dir = dl_manager.download_and_extract(_XML_DOWNLOAD_URL)
67
+ txt_dir = dl_manager.download_and_extract(_TXT_DOWNLOAD_URL)
68
+
69
+ return [
70
+ datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"xml_dir": xml_dir, "txt_dir": txt_dir}),
71
+ ]
72
+
73
+ def _generate_examples(self, xml_dir, txt_dir):
74
+ xml_paths = glob.glob(os.path.join(xml_dir, "udhr_*.xml"))
75
+ for i, xml_path in enumerate(xml_paths):
76
+ lang_attr = ET.parse(xml_path).getroot().attrib
77
+ lang = lang_attr["key"]
78
+
79
+ txt_path = os.path.join(txt_dir, f"udhr_{lang}.txt")
80
+ assert os.path.exists(txt_path), f"xml file {xml_path} found with no corresponding txt file"
81
+
82
+ with open(txt_path, "r", encoding="utf-8") as f:
83
+ lines = f.readlines()[6:] # ignore first 6 lines (metainfo)
84
+ text = "\n".join([line.strip() for line in lines if len(line.strip()) > 0])
85
+
86
+ yield i, {
87
+ "text": text,
88
+ "lang_key": lang,
89
+ "lang_name": lang_attr["n"],
90
+ "iso639-3": lang_attr["iso639-3"],
91
+ "iso15924": lang_attr["iso15924"],
92
+ }