| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| import csv |
| import json |
| import os |
|
|
| import datasets |
|
|
|
|
| |
| _CITATION = """\ |
| @INPROCEEDINGS{10022652, |
| author={Al-Fetyani, Mohammad and Al-Barham, Muhammad and Abandah, Gheith and Alsharkawi, Adham and Dawas, Maha}, |
| booktitle={2022 IEEE Spoken Language Technology Workshop (SLT)}, |
| title={MASC: Massive Arabic Speech Corpus}, |
| year={2023}, |
| volume={}, |
| number={}, |
| pages={1006-1013}, |
| doi={10.1109/SLT54892.2023.10022652}} |
| """ |
|
|
| |
| _DESCRIPTION = """\ |
| This dataset has been collected from twitter which is more than 41 GB of clean data of Arabic Tweets with nearly 4-billion Arabic words (12-million unique Arabic words). |
| """ |
|
|
| _HOMEPAGE = "https://ieee-dataport.org/open-access/masc-massive-arabic-speech-corpus" |
|
|
| _LICENSE = "https://creativecommons.org/licenses/by/4.0/" |
|
|
| |
| |
| _URLS = { |
| "train": "https://huggingface.co/datasets/pain/Arabic-Tweets/blob/main/lm_twitter.txt", |
| } |
|
|
|
|
| |
| class arabic_tweets(datasets.GeneratorBasedBuilder): |
| """This dataset has been collected from twitter which is more than 41 GB of clean data of Arabic Tweets with nearly 4-billion Arabic words (12-million unique Arabic words).""" |
|
|
| VERSION = datasets.Version("1.0.0") |
|
|
| def _info(self): |
|
|
| return datasets.DatasetInfo( |
| |
| description=_DESCRIPTION, |
| |
| features=datasets.Features( |
| { |
| "text": datasets.Value("string") |
| } |
| ), |
| |
| |
| |
| |
| homepage=_HOMEPAGE, |
| |
| license=_LICENSE, |
| |
| citation=_CITATION, |
| ) |
|
|
| def _split_generators(self, dl_manager): |
|
|
| urls = _URLS["train"] |
| data_dir = dl_manager.download_and_extract(urls) |
| return [ |
| datasets.SplitGenerator( |
| name=datasets.Split.TRAIN, |
| |
| gen_kwargs={ |
| "filepath": os.path.join(data_dir), |
| "split": "train", |
| }, |
| ), |
| ] |
|
|
| |
| def _generate_examples(self, filepath, split): |
|
|
| """Yields examples.""" |
| with open(filepath, encoding="utf-8") as f: |
| for idx, row in enumerate(f): |
| if row.strip(): |
| yield idx, {"text": row} |
| else: |
| yield idx, {"text": ""} |