Duplicate from pain/Arabic-Tweets
Browse filesCo-authored-by: Mohammad Albarham <pain@users.noreply.huggingface.co>
- .gitattributes +56 -0
- README.md +71 -0
- arabic-tweets.py +103 -0
- lm_twitter.txt +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.lz4 filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
# Audio files - uncompressed
|
| 37 |
+
*.pcm filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
*.sam filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
*.raw filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
# Audio files - compressed
|
| 41 |
+
*.aac filter=lfs diff=lfs merge=lfs -text
|
| 42 |
+
*.flac filter=lfs diff=lfs merge=lfs -text
|
| 43 |
+
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
| 44 |
+
*.ogg filter=lfs diff=lfs merge=lfs -text
|
| 45 |
+
*.wav filter=lfs diff=lfs merge=lfs -text
|
| 46 |
+
# Image files - uncompressed
|
| 47 |
+
*.bmp filter=lfs diff=lfs merge=lfs -text
|
| 48 |
+
*.gif filter=lfs diff=lfs merge=lfs -text
|
| 49 |
+
*.png filter=lfs diff=lfs merge=lfs -text
|
| 50 |
+
*.tiff filter=lfs diff=lfs merge=lfs -text
|
| 51 |
+
# Image files - compressed
|
| 52 |
+
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 53 |
+
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
+
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
# Text files
|
| 56 |
+
*.txt filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
language:
|
| 4 |
+
- ar
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
# Dataset Card for Dataset Arabic-Tweets
|
| 8 |
+
|
| 9 |
+
## Dataset Description
|
| 10 |
+
|
| 11 |
+
- **Homepage:** https://ieee-dataport.org/open-access/masc-massive-arabic-speech-corpus
|
| 12 |
+
- **Paper:** https://ieeexplore.ieee.org/document/10022652
|
| 13 |
+
|
| 14 |
+
### Dataset Summary
|
| 15 |
+
|
| 16 |
+
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).
|
| 17 |
+
|
| 18 |
+
### Languages
|
| 19 |
+
|
| 20 |
+
Arabic
|
| 21 |
+
|
| 22 |
+
### Source Data
|
| 23 |
+
|
| 24 |
+
Twitter
|
| 25 |
+
|
| 26 |
+
### Example on data loading using streaming:
|
| 27 |
+
|
| 28 |
+
```py
|
| 29 |
+
from datasets import load_dataset
|
| 30 |
+
dataset = load_dataset("pain/Arabic-Tweets",split='train', streaming=True)
|
| 31 |
+
print(next(iter(dataset)))
|
| 32 |
+
```
|
| 33 |
+
|
| 34 |
+
### Example on data loading without streaming "It will be downloaded locally":
|
| 35 |
+
|
| 36 |
+
```py
|
| 37 |
+
from datasets import load_dataset
|
| 38 |
+
dataset = load_dataset("pain/Arabic-Tweets",split='train')
|
| 39 |
+
print(dataset["train"][0])
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
#### Initial Data Collection and Normalization
|
| 43 |
+
|
| 44 |
+
The collected data comprises 100 GB of Twitter raw data. Only tweets with Arabic characters were crawled. It was observed that the new data contained a large number of Persian tweets as well as many Arabic words with repeated characters. Because of this and in order to improve the data efficiency the raw data was processed as follows: hashtags, mentions, and links were removed; tweets that contain Persian characters, 3 consecutive characters, or a singlecharacter word were dropped out; normalization of Arabic letters was considered.
|
| 45 |
+
|
| 46 |
+
This has resulted in more than 41 GB of clean data with nearly 4-billion Arabic words (12-million unique Arabic words).
|
| 47 |
+
|
| 48 |
+
## Considerations for Using the Data
|
| 49 |
+
|
| 50 |
+
- This data has been collected to create a language model. The tweets published without checking the tweets data. Therefore, we are not responsible for any tweets content at all.
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
### Licensing Information
|
| 54 |
+
|
| 55 |
+
[Creative Commons Attribution](https://creativecommons.org/licenses/by/4.0/)
|
| 56 |
+
|
| 57 |
+
### Citation Information
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
```
|
| 61 |
+
@INPROCEEDINGS{10022652,
|
| 62 |
+
author={Al-Fetyani, Mohammad and Al-Barham, Muhammad and Abandah, Gheith and Alsharkawi, Adham and Dawas, Maha},
|
| 63 |
+
booktitle={2022 IEEE Spoken Language Technology Workshop (SLT)},
|
| 64 |
+
title={MASC: Massive Arabic Speech Corpus},
|
| 65 |
+
year={2023},
|
| 66 |
+
volume={},
|
| 67 |
+
number={},
|
| 68 |
+
pages={1006-1013},
|
| 69 |
+
doi={10.1109/SLT54892.2023.10022652}}
|
| 70 |
+
|
| 71 |
+
```
|
arabic-tweets.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
import csv
|
| 16 |
+
import json
|
| 17 |
+
import os
|
| 18 |
+
|
| 19 |
+
import datasets
|
| 20 |
+
|
| 21 |
+
|
| 22 |
+
# Find for instance the citation on arxiv or on the dataset repo/website
|
| 23 |
+
_CITATION = """\
|
| 24 |
+
@INPROCEEDINGS{10022652,
|
| 25 |
+
author={Al-Fetyani, Mohammad and Al-Barham, Muhammad and Abandah, Gheith and Alsharkawi, Adham and Dawas, Maha},
|
| 26 |
+
booktitle={2022 IEEE Spoken Language Technology Workshop (SLT)},
|
| 27 |
+
title={MASC: Massive Arabic Speech Corpus},
|
| 28 |
+
year={2023},
|
| 29 |
+
volume={},
|
| 30 |
+
number={},
|
| 31 |
+
pages={1006-1013},
|
| 32 |
+
doi={10.1109/SLT54892.2023.10022652}}
|
| 33 |
+
"""
|
| 34 |
+
|
| 35 |
+
# You can copy an official description
|
| 36 |
+
_DESCRIPTION = """\
|
| 37 |
+
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).
|
| 38 |
+
"""
|
| 39 |
+
|
| 40 |
+
_HOMEPAGE = "https://ieee-dataport.org/open-access/masc-massive-arabic-speech-corpus"
|
| 41 |
+
|
| 42 |
+
_LICENSE = "https://creativecommons.org/licenses/by/4.0/"
|
| 43 |
+
|
| 44 |
+
# The HuggingFace Datasets library doesn't host the datasets but only points to the original files.
|
| 45 |
+
# This can be an arbitrary nested dict/list of URLs (see below in `_split_generators` method)
|
| 46 |
+
_URLS = {
|
| 47 |
+
"train": "https://huggingface.co/datasets/pain/Arabic-Tweets/blob/main/lm_twitter.txt",
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
# TODO: Name of the dataset usually matches the script name with CamelCase instead of snake_case
|
| 52 |
+
class arabic_tweets(datasets.GeneratorBasedBuilder):
|
| 53 |
+
"""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)."""
|
| 54 |
+
|
| 55 |
+
VERSION = datasets.Version("1.0.0")
|
| 56 |
+
|
| 57 |
+
def _info(self):
|
| 58 |
+
|
| 59 |
+
return datasets.DatasetInfo(
|
| 60 |
+
# This is the description that will appear on the datasets page.
|
| 61 |
+
description=_DESCRIPTION,
|
| 62 |
+
# This defines the different columns of the dataset and their types
|
| 63 |
+
features=datasets.Features(
|
| 64 |
+
{
|
| 65 |
+
"text": datasets.Value("string")
|
| 66 |
+
}
|
| 67 |
+
), # Here we define them above because they are different between the two configurations
|
| 68 |
+
# If there's a common (input, target) tuple from the features, uncomment supervised_keys line below and
|
| 69 |
+
# specify them. They'll be used if as_supervised=True in builder.as_dataset.
|
| 70 |
+
# supervised_keys=("sentence", "label"),
|
| 71 |
+
# Homepage of the dataset for documentation
|
| 72 |
+
homepage=_HOMEPAGE,
|
| 73 |
+
# License for the dataset if available
|
| 74 |
+
license=_LICENSE,
|
| 75 |
+
# Citation for the dataset
|
| 76 |
+
citation=_CITATION,
|
| 77 |
+
)
|
| 78 |
+
|
| 79 |
+
def _split_generators(self, dl_manager):
|
| 80 |
+
|
| 81 |
+
urls = _URLS["train"]
|
| 82 |
+
data_dir = dl_manager.download_and_extract(urls)
|
| 83 |
+
return [
|
| 84 |
+
datasets.SplitGenerator(
|
| 85 |
+
name=datasets.Split.TRAIN,
|
| 86 |
+
# These kwargs will be passed to _generate_examples
|
| 87 |
+
gen_kwargs={
|
| 88 |
+
"filepath": os.path.join(data_dir),
|
| 89 |
+
"split": "train",
|
| 90 |
+
},
|
| 91 |
+
),
|
| 92 |
+
]
|
| 93 |
+
|
| 94 |
+
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 95 |
+
def _generate_examples(self, filepath, split):
|
| 96 |
+
|
| 97 |
+
"""Yields examples."""
|
| 98 |
+
with open(filepath, encoding="utf-8") as f:
|
| 99 |
+
for idx, row in enumerate(f):
|
| 100 |
+
if row.strip():
|
| 101 |
+
yield idx, {"text": row}
|
| 102 |
+
else:
|
| 103 |
+
yield idx, {"text": ""}
|
lm_twitter.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2d404126e9d87b5377f3e35cacbc449b1770865d65633b3ba5dc4e3dc05a991d
|
| 3 |
+
size 41031669538
|