albertvillanova HF staff commited on
Commit
1ed7b98
1 Parent(s): 2700399

Convert dataset to Parquet (#4)

Browse files

- Convert dataset to Parquet (e1401370f1ab0f1d4409c02b6eeda980edc67c1e)
- Delete loading script (63484709c8bb47e3a67af277ed38b7ec534495d0)

README.md CHANGED
@@ -40,13 +40,20 @@ dataset_info:
40
  '4': sbz
41
  splits:
42
  - name: train
43
- num_bytes: 1762905
44
  num_examples: 638
45
  - name: test
46
- num_bytes: 799587
47
  num_examples: 262
48
- download_size: 1042653
49
- dataset_size: 2562492
 
 
 
 
 
 
 
50
  ---
51
 
52
  # Dataset Card for Bend the Truth (Urdu Fake News)
 
40
  '4': sbz
41
  splits:
42
  - name: train
43
+ num_bytes: 1762901
44
  num_examples: 638
45
  - name: test
46
+ num_bytes: 799583
47
  num_examples: 262
48
+ download_size: 1187921
49
+ dataset_size: 2562484
50
+ configs:
51
+ - config_name: default
52
+ data_files:
53
+ - split: train
54
+ path: data/train-*
55
+ - split: test
56
+ path: data/test-*
57
  ---
58
 
59
  # Dataset Card for Bend the Truth (Urdu Fake News)
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2337bbb1161129674e3dbd1a48888c4402c512c77356c643d32d92dcdd2f20ba
3
+ size 374535
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b1fdfb8d0f06873f64d42a9ad1db896daf9e41a431b8176019c19df6316acb19
3
+ size 813386
urdu_fake_news.py DELETED
@@ -1,97 +0,0 @@
1
- """Urdu Fake News Dataset"""
2
-
3
-
4
- import glob
5
- import os
6
-
7
- import datasets
8
-
9
-
10
- _CITATION = """
11
- @article{MaazUrdufake2020,
12
- author = {Amjad, Maaz and Sidorov, Grigori and Zhila, Alisa and G’{o}mez-Adorno, Helena and Voronkov, Ilia and Gelbukh, Alexander},
13
- title = {Bend the Truth: A Benchmark Dataset for Fake News Detection in Urdu and Its Evaluation},
14
- journal={Journal of Intelligent & Fuzzy Systems},
15
- volume={39},
16
- number={2},
17
- pages={2457-2469},
18
- doi = {10.3233/JIFS-179905},
19
- year={2020},
20
- publisher={IOS Press}
21
- }
22
- """
23
-
24
- _DESCRIPTION = """
25
- Urdu fake news datasets that contain news of 5 different news domains.
26
- These domains are Sports, Health, Technology, Entertainment, and Business.
27
- The real news are collected by combining manual approaches.
28
- """
29
-
30
- _URL = "https://github.com/MaazAmjad/Datasets-for-Urdu-news/blob/master/"
31
- _URL += "Urdu%20Fake%20News%20Dataset.zip?raw=true"
32
-
33
-
34
- class UrduFakeNews(datasets.GeneratorBasedBuilder):
35
- VERSION = datasets.Version("1.0.0")
36
-
37
- category_list = [
38
- "bus",
39
- "hlth",
40
- "sp",
41
- "tch",
42
- "sbz",
43
- ]
44
-
45
- def _info(self):
46
- labels_list = ["Fake", "Real"]
47
-
48
- return datasets.DatasetInfo(
49
- description=_DESCRIPTION,
50
- features=datasets.Features(
51
- {
52
- "news": datasets.Value("string"),
53
- "label": datasets.ClassLabel(names=labels_list),
54
- "category": datasets.ClassLabel(names=self.category_list),
55
- }
56
- ),
57
- homepage="https://github.com/MaazAmjad/Datasets-for-Urdu-news",
58
- citation=_CITATION,
59
- )
60
-
61
- def _split_generators(self, dl_manager):
62
- """Returns SplitGenerators."""
63
- dl_path = dl_manager.download_and_extract(_URL)
64
- input_path = os.path.join(dl_path, "1.Corpus")
65
- return [
66
- datasets.SplitGenerator(
67
- name=datasets.Split.TRAIN,
68
- gen_kwargs={"pattern": os.path.join(input_path, "Train", "*", "*.txt")},
69
- ),
70
- datasets.SplitGenerator(
71
- name=datasets.Split.TEST,
72
- gen_kwargs={"pattern": os.path.join(input_path, "Test", "*", "*.txt")},
73
- ),
74
- ]
75
-
76
- def _generate_examples(self, pattern=None):
77
- """Yields examples."""
78
- for filename in sorted(glob.glob(pattern)):
79
-
80
- with open(filename, encoding="utf-8") as f:
81
- news = ""
82
- for line in f:
83
- if line == "\n":
84
- continue
85
- news += line
86
-
87
- name = os.path.basename(filename)
88
- key = name.rstrip(".txt")
89
-
90
- _class = 1 if ("Real" in filename) else 0
91
- _class_name = "Real" if ("Real" in filename) else "Fake"
92
- category = "".join([i for i in key if not i.isdigit()])
93
- if category == "":
94
- continue
95
- category = self.category_list.index(category)
96
-
97
- yield f"{_class_name}_{key}", {"news": news, "label": _class, "category": category}