richardlastrucci commited on
Commit
7172f08
1 Parent(s): ff03cc5

Delete vukuzenzele-sentence-aligned.py

Browse files
Files changed (1) hide show
  1. vukuzenzele-sentence-aligned.py +0 -97
vukuzenzele-sentence-aligned.py DELETED
@@ -1,97 +0,0 @@
1
-
2
- """TODO: Add a description here."""
3
-
4
-
5
- import csv
6
- import json
7
- import os
8
-
9
- import datasets
10
-
11
- from itertools import combinations
12
-
13
- LANGUAGES = ['afr', 'eng', 'nbl', 'nso', 'sot', 'ssw', 'tsn', 'tso', 'ven', 'xho', 'zul']
14
- LANGUAGE_PAIRS = list(combinations(LANGUAGES, 2))
15
-
16
- _CITATION = """\
17
- @dataset{marivate_vukosi_2023_7598540, author = {Marivate, Vukosi and Njini, Daniel and Madodonga, Andani and Lastrucci, Richard and Dzingirai, Isheanesu Rajab, Jenalea}, title = {The Vuk'uzenzele South African Multilingual Corpus}, month = feb, year = 2023, publisher = {Zenodo}, doi = {10.5281/zenodo.7598539}, url = {https://doi.org/10.5281/zenodo.7598539} }
18
- """
19
-
20
- _DESCRIPTION = """\
21
- The dataset contains editions from the South African government magazine Vuk'uzenzele. Data was scraped from PDFs that have been placed in the data/raw folder. The PDFS were obtained from the Vuk'uzenzele website.
22
- """
23
-
24
- _HOMEPAGE = "https://arxiv.org/abs/2303.03750"
25
-
26
- _LICENSE = "CC 4.0 BY"
27
-
28
- _URL = "https://raw.githubusercontent.com/dsfsi/vukuzenzele-nlp/master/data/opt_aligned_out/"
29
-
30
- class VukuzenzeleMonolingualConfig(datasets.BuilderConfig):
31
- """BuilderConfig for VukuzenzeleMonolingual"""
32
-
33
- def __init__(self, **kwargs):
34
- """BuilderConfig for Masakhaner.
35
- Args:
36
- **kwargs: keyword arguments forwarded to super.
37
- """
38
- super(VukuzenzeleMonolingualConfig, self).__init__(**kwargs)
39
-
40
-
41
- # TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
42
- class VukuzenzeleMonolingual(datasets.GeneratorBasedBuilder):
43
- """TODO: Short description of my dataset."""
44
-
45
- VERSION = datasets.Version("1.0.0")
46
- BUILDER_CONFIGS = []
47
-
48
- for pair in LANGUAGE_PAIRS:
49
- name = "aligned-{}-{}.jsonl".format(pair[0], pair[1])
50
- description = "Vukuzenzele {}-{} aligned dataset".format(pair[0], pair[1])
51
- BUILDER_CONFIGS.append(datasets.BuilderConfig(name=f"{name}", version=VERSION, description=f"{description}"),)
52
-
53
- def _info(self):
54
- features = datasets.Features(
55
- {
56
- "src": datasets.Value("string"),
57
- "tgt": datasets.Value("string"),
58
- "score": datasets.Value("float"),
59
- }
60
- )
61
- return datasets.DatasetInfo(
62
- description=_DESCRIPTION,
63
- features=features,
64
- homepage=_HOMEPAGE,
65
- license=_LICENSE,
66
- # Citation for the dataset
67
- citation=_CITATION,
68
- )
69
-
70
- def _split_generators(self, dl_manager):
71
-
72
-
73
-
74
- urls = {
75
- "train": f"{_URL}{self.config.name}"
76
- }
77
- data_dir = dl_manager.download_and_extract(urls)
78
- return [
79
- datasets.SplitGenerator(
80
- name=datasets.Split.TRAIN,
81
- gen_kwargs={
82
- "filepath": data_dir["train"],
83
- "split": "train",
84
- },
85
- ),
86
- ]
87
-
88
- def _generate_examples(self, filepath, split):
89
- with open(filepath, encoding="utf-8") as f:
90
- for key, row in enumerate(f):
91
- data = json.loads(row)
92
- yield key, {
93
- "src": data["src"],
94
- "tgt": data["tgt"],
95
- "score": data["score"],
96
- }
97
-