| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| |
| """Arabic Poetry Metric dataset.""" |
|
|
|
|
| import os |
| import datasets |
| import pandas as pd |
|
|
| _DESCRIPTION = """\ |
| Masader is the largest public catalogue for Arabic NLP datasets, which consists of more than 200 datasets annotated with 25 attributes. |
| """ |
|
|
| _CITATION = """\ |
| @misc{alyafeai2021masader, |
| title={Masader: Metadata Sourcing for Arabic Text and Speech Data Resources}, |
| author={Zaid Alyafeai and Maraim Masoud and Mustafa Ghaleb and Maged S. Al-shaibani}, |
| year={2021}, |
| eprint={2110.06744}, |
| archivePrefix={arXiv}, |
| primaryClass={cs.CL} |
| } |
| """ |
|
|
|
|
| class AdawatConfig(datasets.BuilderConfig): |
| """BuilderConfig for Masader.""" |
|
|
| def __init__(self, **kwargs): |
| """BuilderConfig for Adawat. |
| |
| Args: |
| **kwargs: keyword arguments forwarded to super. |
| """ |
| super(AdawatConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs) |
|
|
|
|
| class Adawat(datasets.GeneratorBasedBuilder): |
| """Adawatdataset.""" |
|
|
| BUILDER_CONFIGS = [ |
| AdawatConfig( |
| name="plain_text", |
| description="Plain text", |
| ) |
| ] |
|
|
| def _info(self): |
| return datasets.DatasetInfo( |
| description=_DESCRIPTION, |
| features=datasets.Features( |
| { |
| 'Id': datasets.Value("string"), |
| 'Name': datasets.Value("string"), |
| 'Link': datasets.Value("string"), |
| 'Colab link': datasets.Value("string"), |
| 'GitHub Repo': datasets.Value("string"), |
| 'Pricing': datasets.Value("string"), |
| 'Accessibility': datasets.Value("string"), |
| 'License': datasets.Value("string"), |
| 'Version': datasets.Value("string"), |
| 'Description': datasets.Value("string"), |
| 'Paper Title': datasets.Value("string"), |
| 'Paper URL': datasets.Value("string"), |
| 'Release Year': datasets.Value("int32"), |
| 'Tasks': datasets.Value("string"), |
| 'Supported language(s)': datasets.Value("string"), |
| 'Tool Type': datasets.Value("string"), |
| 'Interface': datasets.Value("string"), |
| 'Programming Language': datasets.Value("string"), |
| 'Added by': datasets.Value("string"), |
| 'Evaluated datasets': datasets.Value("string"), |
| } |
| ), |
| supervised_keys=None, |
| homepage="https://github.com/arbml/Masader", |
| citation=_CITATION,) |
|
|
| def _split_generators(self, dl_manager): |
| sheet_id = "1uLqCbygNS9Pvsp1UkkR4Qe9SQrJVwpZDXzcpBfufmE8" |
| sheet_name = "main" |
| url = f"https://docs.google.com/spreadsheets/d/{sheet_id}/gviz/tq?tqx=out:csv&sheet={sheet_name}" |
| |
| return [ |
| datasets.SplitGenerator( |
| name=datasets.Split.TRAIN, gen_kwargs={"url":url } |
| ), |
| ] |
|
|
| def _generate_examples(self, url): |
| """Generate examples.""" |
| |
| |
| |
| df = pd.read_csv(url, usecols=range(22)) |
| entry_list = [] |
| i = 0 |
| idx = 0 |
| |
| for i in range(len(df)): |
| masader_entry = {col.strip():df.values[i][j] for j,col in enumerate(df.columns) if j not in [18,20]} |
| yield i, masader_entry |