Commit
•
19d107e
1
Parent(s):
4f6106b
Delete loading script
Browse files- tashkeela.py +0 -104
tashkeela.py
DELETED
@@ -1,104 +0,0 @@
|
|
1 |
-
# coding=utf-8
|
2 |
-
# Copyright 2020 The TensorFlow Datasets Authors and the 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 |
-
"""Arabic Vocalized Words Dataset."""
|
18 |
-
|
19 |
-
|
20 |
-
import glob
|
21 |
-
import os
|
22 |
-
|
23 |
-
import datasets
|
24 |
-
|
25 |
-
|
26 |
-
_DESCRIPTION = """\
|
27 |
-
Arabic vocalized texts.
|
28 |
-
it contains 75 million of fully vocalized words mainly\
|
29 |
-
97 books from classical and modern Arabic language.
|
30 |
-
"""
|
31 |
-
|
32 |
-
_CITATION = """\
|
33 |
-
@article{zerrouki2017tashkeela,
|
34 |
-
title={Tashkeela: Novel corpus of Arabic vocalized texts, data for auto-diacritization systems},
|
35 |
-
author={Zerrouki, Taha and Balla, Amar},
|
36 |
-
journal={Data in brief},
|
37 |
-
volume={11},
|
38 |
-
pages={147},
|
39 |
-
year={2017},
|
40 |
-
publisher={Elsevier}
|
41 |
-
}
|
42 |
-
"""
|
43 |
-
|
44 |
-
_HOMEPAGE = "https://sourceforge.net/projects/tashkeela/"
|
45 |
-
|
46 |
-
_LICENSE = "GPLv2"
|
47 |
-
|
48 |
-
_DOWNLOAD_URL = "https://sourceforge.net/projects/tashkeela/files/latest/download"
|
49 |
-
|
50 |
-
|
51 |
-
class TashkeelaConfig(datasets.BuilderConfig):
|
52 |
-
"""BuilderConfig for Tashkeela."""
|
53 |
-
|
54 |
-
def __init__(self, **kwargs):
|
55 |
-
"""BuilderConfig for Tashkeela.
|
56 |
-
|
57 |
-
Args:
|
58 |
-
**kwargs: keyword arguments forwarded to super.
|
59 |
-
"""
|
60 |
-
super(TashkeelaConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
61 |
-
|
62 |
-
|
63 |
-
class Tashkeela(datasets.GeneratorBasedBuilder):
|
64 |
-
"""Tashkeela dataset."""
|
65 |
-
|
66 |
-
BUILDER_CONFIGS = [
|
67 |
-
TashkeelaConfig(
|
68 |
-
name="plain_text",
|
69 |
-
description="Plain text",
|
70 |
-
)
|
71 |
-
]
|
72 |
-
|
73 |
-
def _info(self):
|
74 |
-
return datasets.DatasetInfo(
|
75 |
-
description=_DESCRIPTION,
|
76 |
-
features=datasets.Features(
|
77 |
-
{
|
78 |
-
"book": datasets.Value("string"),
|
79 |
-
"text": datasets.Value("string"),
|
80 |
-
}
|
81 |
-
),
|
82 |
-
supervised_keys=None,
|
83 |
-
homepage=_HOMEPAGE,
|
84 |
-
license=_LICENSE,
|
85 |
-
citation=_CITATION,
|
86 |
-
)
|
87 |
-
|
88 |
-
def _split_generators(self, dl_manager):
|
89 |
-
arch_path = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
90 |
-
return [
|
91 |
-
datasets.SplitGenerator(
|
92 |
-
name=datasets.Split.TRAIN,
|
93 |
-
gen_kwargs={
|
94 |
-
"directory": os.path.join(arch_path, "Tashkeela-arabic-diacritized-text-utf8-0.3", "texts.txt")
|
95 |
-
},
|
96 |
-
),
|
97 |
-
]
|
98 |
-
|
99 |
-
def _generate_examples(self, directory):
|
100 |
-
"""Generate examples."""
|
101 |
-
|
102 |
-
for id_, file_name in enumerate(sorted(glob.glob(os.path.join(directory, "**.txt")))):
|
103 |
-
with open(file_name, encoding="UTF-8") as f:
|
104 |
-
yield str(id_), {"book": file_name, "text": f.read().strip()}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|