Update ultimate_arabic_news.py
Browse files- ultimate_arabic_news.py +1 -56
ultimate_arabic_news.py
CHANGED
@@ -22,7 +22,7 @@ class UAN_Config(datasets.BuilderConfig):
|
|
22 |
"""
|
23 |
super(UAN_Config, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
24 |
|
25 |
-
|
26 |
class Ultimate_Arabic_News(datasets.GeneratorBasedBuilder):
|
27 |
VERSION = datasets.Version("1.1.0")
|
28 |
BUILDER_CONFIGS = [
|
@@ -47,58 +47,3 @@ class Ultimate_Arabic_News(datasets.GeneratorBasedBuilder):
|
|
47 |
),
|
48 |
]
|
49 |
|
50 |
-
def _info(self):
|
51 |
-
# TODO(tydiqa): Specifies the datasets.DatasetInfo object
|
52 |
-
return datasets.DatasetInfo(
|
53 |
-
# This is the description that will appear on the datasets page.
|
54 |
-
description=_DESCRIPTION,
|
55 |
-
# datasets.features.FeatureConnectors
|
56 |
-
features=datasets.Features(
|
57 |
-
{
|
58 |
-
|
59 |
-
"text": datasets.Value("string"),
|
60 |
-
"label": datasets.Value("string"),
|
61 |
-
|
62 |
-
),
|
63 |
-
# If there's a common (input, target) tuple from the features,
|
64 |
-
# specify them here. They'll be used if as_supervised=True in
|
65 |
-
# builder.as_dataset.
|
66 |
-
supervised_keys=None,
|
67 |
-
# Homepage of the dataset for documentation
|
68 |
-
homepage="https://data.mendeley.com/datasets/jz56k5wxz7/1",
|
69 |
-
citation=_CITATION,
|
70 |
-
)
|
71 |
-
|
72 |
-
|
73 |
-
def _split_generators(self, dl_manager):
|
74 |
-
"""Returns SplitGenerators."""
|
75 |
-
# TODO(tydiqa): Downloads the data and defines the splits
|
76 |
-
# dl_manager is a datasets.download.DownloadManager that can be used to
|
77 |
-
# download and extract URLs
|
78 |
-
UltAr_downloaded = dl_manager.download_and_extract(_URL['UltimateArabic'])
|
79 |
-
UltArPre_downloaded = dl_manager.download_and_extract(_URL['UltimateArabicPrePros'])
|
80 |
-
if self.config.name == "UltimateArabic":
|
81 |
-
return [
|
82 |
-
datasets.SplitGenerator(
|
83 |
-
name=datasets.Split.TRAIN,
|
84 |
-
# These kwargs will be passed to _generate_examples
|
85 |
-
gen_kwargs={"filepath": UltAr_downloaded["train"]},
|
86 |
-
),
|
87 |
-
]
|
88 |
-
elif self.config.name == "UltimateArabicPrePros":
|
89 |
-
return [
|
90 |
-
datasets.SplitGenerator(
|
91 |
-
name=datasets.Split.TRAIN,
|
92 |
-
# These kwargs will be passed to _generate_examples
|
93 |
-
gen_kwargs={"filepath": UltArPre_downloaded["train"]},
|
94 |
-
),
|
95 |
-
|
96 |
-
]
|
97 |
-
|
98 |
-
def _generate_examples(self, csv_file):
|
99 |
-
with open(csv_file, encoding="utf-8") as f:
|
100 |
-
data = csv.DictReader(f)
|
101 |
-
for row, item in enumerate(data):
|
102 |
-
yield row, {"text": item['text'],"label": item['label']}
|
103 |
-
|
104 |
-
|
|
|
22 |
"""
|
23 |
super(UAN_Config, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
24 |
|
25 |
+
|
26 |
class Ultimate_Arabic_News(datasets.GeneratorBasedBuilder):
|
27 |
VERSION = datasets.Version("1.1.0")
|
28 |
BUILDER_CONFIGS = [
|
|
|
47 |
),
|
48 |
]
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|