Datasets:
Tasks:
Text Classification
Modalities:
Text
Formats:
parquet
Languages:
Arabic
Size:
10K - 100K
Tags:
poetry-classification
License:
Commit
•
672785c
1
Parent(s):
bae1927
Convert dataset to Parquet (#4)
Browse files- Convert dataset to Parquet (c7613485e9c7e5540443a42d431b53303a522ff0)
- Delete loading script (4603bc9d6e33db27a6a72c7e7a66f1137b6b0aec)
- README.md +13 -5
- metrec.py +0 -124
- plain_text/test-00000-of-00001.parquet +3 -0
- plain_text/train-00000-of-00001.parquet +3 -0
README.md
CHANGED
@@ -21,6 +21,7 @@ pretty_name: MetRec
|
|
21 |
tags:
|
22 |
- poetry-classification
|
23 |
dataset_info:
|
|
|
24 |
features:
|
25 |
- name: text
|
26 |
dtype: string
|
@@ -42,16 +43,23 @@ dataset_info:
|
|
42 |
'11': wafer
|
43 |
'12': hazaj
|
44 |
'13': rajaz
|
45 |
-
config_name: plain_text
|
46 |
splits:
|
47 |
- name: train
|
48 |
-
num_bytes:
|
49 |
num_examples: 47124
|
50 |
- name: test
|
51 |
-
num_bytes:
|
52 |
num_examples: 8316
|
53 |
-
download_size:
|
54 |
-
dataset_size:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
---
|
56 |
|
57 |
# Dataset Card for MetRec
|
|
|
21 |
tags:
|
22 |
- poetry-classification
|
23 |
dataset_info:
|
24 |
+
config_name: plain_text
|
25 |
features:
|
26 |
- name: text
|
27 |
dtype: string
|
|
|
43 |
'11': wafer
|
44 |
'12': hazaj
|
45 |
'13': rajaz
|
|
|
46 |
splits:
|
47 |
- name: train
|
48 |
+
num_bytes: 5874899
|
49 |
num_examples: 47124
|
50 |
- name: test
|
51 |
+
num_bytes: 1037573
|
52 |
num_examples: 8316
|
53 |
+
download_size: 3979947
|
54 |
+
dataset_size: 6912472
|
55 |
+
configs:
|
56 |
+
- config_name: plain_text
|
57 |
+
data_files:
|
58 |
+
- split: train
|
59 |
+
path: plain_text/train-*
|
60 |
+
- split: test
|
61 |
+
path: plain_text/test-*
|
62 |
+
default: true
|
63 |
---
|
64 |
|
65 |
# Dataset Card for MetRec
|
metrec.py
DELETED
@@ -1,124 +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 Poetry Metric dataset."""
|
18 |
-
|
19 |
-
|
20 |
-
import os
|
21 |
-
|
22 |
-
import datasets
|
23 |
-
from datasets.tasks import TextClassification
|
24 |
-
|
25 |
-
|
26 |
-
_DESCRIPTION = """\
|
27 |
-
Arabic Poetry Metric Classification.
|
28 |
-
The dataset contains the verses and their corresponding meter classes.\
|
29 |
-
Meter classes are represented as numbers from 0 to 13. \
|
30 |
-
The dataset can be highly useful for further research in order to improve the field of Arabic poems’ meter classification.\
|
31 |
-
The train dataset contains 47,124 records and the test dataset contains 8316 records.
|
32 |
-
"""
|
33 |
-
|
34 |
-
_CITATION = """\
|
35 |
-
@article{metrec2020,
|
36 |
-
title={MetRec: A dataset for meter classification of arabic poetry},
|
37 |
-
author={Al-shaibani, Maged S and Alyafeai, Zaid and Ahmad, Irfan},
|
38 |
-
journal={Data in Brief},
|
39 |
-
year={2020},
|
40 |
-
publisher={Elsevier}
|
41 |
-
}
|
42 |
-
"""
|
43 |
-
|
44 |
-
_DOWNLOAD_URL = "https://raw.githubusercontent.com/zaidalyafeai/MetRec/master/baits.zip"
|
45 |
-
|
46 |
-
|
47 |
-
class MetRecConfig(datasets.BuilderConfig):
|
48 |
-
"""BuilderConfig for MetRec."""
|
49 |
-
|
50 |
-
def __init__(self, **kwargs):
|
51 |
-
"""BuilderConfig for MetRec.
|
52 |
-
|
53 |
-
Args:
|
54 |
-
**kwargs: keyword arguments forwarded to super.
|
55 |
-
"""
|
56 |
-
super(MetRecConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
|
57 |
-
|
58 |
-
|
59 |
-
class Metrec(datasets.GeneratorBasedBuilder):
|
60 |
-
"""Metrec dataset."""
|
61 |
-
|
62 |
-
BUILDER_CONFIGS = [
|
63 |
-
MetRecConfig(
|
64 |
-
name="plain_text",
|
65 |
-
description="Plain text",
|
66 |
-
)
|
67 |
-
]
|
68 |
-
|
69 |
-
def _info(self):
|
70 |
-
return datasets.DatasetInfo(
|
71 |
-
description=_DESCRIPTION,
|
72 |
-
features=datasets.Features(
|
73 |
-
{
|
74 |
-
"text": datasets.Value("string"),
|
75 |
-
"label": datasets.features.ClassLabel(
|
76 |
-
names=[
|
77 |
-
"saree",
|
78 |
-
"kamel",
|
79 |
-
"mutakareb",
|
80 |
-
"mutadarak",
|
81 |
-
"munsareh",
|
82 |
-
"madeed",
|
83 |
-
"mujtath",
|
84 |
-
"ramal",
|
85 |
-
"baseet",
|
86 |
-
"khafeef",
|
87 |
-
"taweel",
|
88 |
-
"wafer",
|
89 |
-
"hazaj",
|
90 |
-
"rajaz",
|
91 |
-
]
|
92 |
-
),
|
93 |
-
}
|
94 |
-
),
|
95 |
-
supervised_keys=None,
|
96 |
-
homepage="https://github.com/zaidalyafeai/MetRec",
|
97 |
-
citation=_CITATION,
|
98 |
-
task_templates=[TextClassification(text_column="text", label_column="label")],
|
99 |
-
)
|
100 |
-
|
101 |
-
def _vocab_text_gen(self, archive):
|
102 |
-
for _, ex in self._generate_examples(archive, os.path.join("final_baits", "train.txt")):
|
103 |
-
yield ex["text"]
|
104 |
-
|
105 |
-
def _split_generators(self, dl_manager):
|
106 |
-
arch_path = dl_manager.download_and_extract(_DOWNLOAD_URL)
|
107 |
-
data_dir = os.path.join(arch_path, "final_baits")
|
108 |
-
return [
|
109 |
-
datasets.SplitGenerator(
|
110 |
-
name=datasets.Split.TRAIN, gen_kwargs={"directory": os.path.join(data_dir, "train.txt")}
|
111 |
-
),
|
112 |
-
datasets.SplitGenerator(
|
113 |
-
name=datasets.Split.TEST, gen_kwargs={"directory": os.path.join(data_dir, "test.txt")}
|
114 |
-
),
|
115 |
-
]
|
116 |
-
|
117 |
-
def _generate_examples(self, directory, labeled=True):
|
118 |
-
"""Generate examples."""
|
119 |
-
# For labeled examples, extract the label from the path.
|
120 |
-
|
121 |
-
with open(directory, encoding="UTF-8") as f:
|
122 |
-
for id_, record in enumerate(f.read().splitlines()):
|
123 |
-
label, bait = record.split(" ", 1)
|
124 |
-
yield str(id_), {"text": bait, "label": int(label)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
plain_text/test-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:c9f4af808f9d8c545adea5ef2aee0d0b021ba459ee14eb6be2adb2883de83f8c
|
3 |
+
size 598051
|
plain_text/train-00000-of-00001.parquet
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:de17005b532938ff5f76e684663e84d2f8a91f4fc7e6e5e1befa6528def96bdc
|
3 |
+
size 3381896
|