Vinay Setty commited on
Commit
235d34e
·
1 Parent(s): a2bfa22

Initial arabic data commit

Browse files
Files changed (4) hide show
  1. clef24_dataset_twitter.py +80 -0
  2. data/dev.tsv +0 -0
  3. data/test.tsv +0 -0
  4. data/train.tsv +0 -0
clef24_dataset_twitter.py ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Multilang Dataset loading script."""
2
+
3
+ from datasets import DatasetInfo, BuilderConfig, Version, GeneratorBasedBuilder, DownloadManager
4
+ from datasets import SplitGenerator, Split, Features, Value
5
+ from typing import Generator, Tuple, Union
6
+
7
+ import os
8
+
9
+ _DESCRIPTION = """
10
+ This dataset includes Arabic/Dutch/Spanish Twitter data for CLEF 2024 CheckThat! Lab task1.
11
+ """
12
+
13
+ _CITATION = """\
14
+ @inproceedings{barron2024clef,
15
+ title={The CLEF-2024 CheckThat! Lab: Check-Worthiness, Subjectivity, Persuasion, Roles, Authorities, and Adversarial Robustness},
16
+ author={Barr{\'o}n-Cede{\~n}o, Alberto and Alam, Firoj and Chakraborty, Tanmoy and Elsayed, Tamer and Nakov, Preslav and Przyby{\l}a, Piotr and Stru{\ss}, Julia Maria and Haouari, Fatima and Hasanain, Maram and Ruggeri, Federico and others},
17
+ booktitle={European Conference on Information Retrieval},
18
+ pages={449--458},
19
+ year={2024},
20
+ organization={Springer}
21
+ }
22
+ """
23
+
24
+ _LICENSE = "Your dataset's license here."
25
+
26
+ class CLEF24EsData(GeneratorBasedBuilder):
27
+ """A multilingual text dataset."""
28
+
29
+ BUILDER_CONFIGS = [
30
+ BuilderConfig(name="clef24_tweet_data", version=Version("1.0.0"), description="Multilingual dataset for text classification."),
31
+ ]
32
+
33
+ DEFAULT_CONFIG_NAME = "clef24_tweet_data" # Default configuration name.
34
+
35
+ def _info(self):
36
+ """Construct the DatasetInfo object."""
37
+ return DatasetInfo(
38
+ description=_DESCRIPTION,
39
+ features=Features({
40
+ "tweet_id": Value("string"),
41
+ "tweet_url": Value("string"),
42
+ "tweet_text": Value("string"),
43
+ "class_label": Value("string"),
44
+ }),
45
+ supervised_keys=("tweet_text", "class_label"),
46
+ homepage="https://gitlab.com/checkthat_lab/clef2024-checkthat-lab/-/tree/main/task1",
47
+ citation=_CITATION,
48
+ license=_LICENSE,
49
+ )
50
+
51
+ def _split_generators(self, dl_manager: DownloadManager) -> list[SplitGenerator]:
52
+ """Returns SplitGenerators."""
53
+ # Assumes your dataset is located in "data"
54
+ data_dir = os.path.abspath("data")
55
+ splits = {"train": Split.TRAIN, "dev": Split.VALIDATION, "test": Split.TEST}
56
+
57
+ return [
58
+ SplitGenerator(
59
+ name=splits[split],
60
+ gen_kwargs={
61
+ "filepath": os.path.join(data_dir, f"{split}.tsv"),
62
+ "split": splits[split]
63
+ },
64
+ )
65
+ for split in splits.keys()
66
+ ]
67
+
68
+ def _generate_examples(self, filepath: Union[str, os.PathLike], split: str) -> Generator[Tuple[str, dict], None, None]:
69
+ """Yields examples."""
70
+ with open(filepath, encoding="utf-8") as f:
71
+ for id_, row in enumerate(f):
72
+ if id_ == 0: # Optionally skip header
73
+ continue
74
+ cols = row.strip().split('\t')
75
+ yield f"{split}_{id_}", {
76
+ "tweet_id": cols[0],
77
+ "tweet_url": cols[1],
78
+ "tweet_text": cols[2],
79
+ "class_label": cols[3],
80
+ }
data/dev.tsv ADDED
The diff for this file is too large to render. See raw diff
 
data/test.tsv ADDED
The diff for this file is too large to render. See raw diff
 
data/train.tsv ADDED
The diff for this file is too large to render. See raw diff