Datasets:
Tasks:
Text Classification
Modalities:
Text
Sub-tasks:
fact-checking
Languages:
English
Size:
1K - 10K
ArXiv:
Tags:
stance-detection
License:
test done
Browse files- rumoureval2019_test.csv +0 -0
- rumoureval_2019.py +15 -17
rumoureval2019_test.csv
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
rumoureval_2019.py
CHANGED
|
@@ -51,12 +51,12 @@ class RumourEval2019Config(datasets.BuilderConfig):
|
|
| 51 |
super(RumourEval2019Config, self).__init__(**kwargs)
|
| 52 |
|
| 53 |
class RumourEval2019(datasets.GeneratorBasedBuilder):
|
| 54 |
-
"""
|
| 55 |
|
| 56 |
VERSION = datasets.Version("0.9.0")
|
| 57 |
|
| 58 |
BUILDER_CONFIGS = [
|
| 59 |
-
RumourEval2019Config(name="RumourEval2019", version=VERSION, description="Stance Detection
|
| 60 |
]
|
| 61 |
|
| 62 |
def _info(self):
|
|
@@ -87,23 +87,21 @@ class RumourEval2019(datasets.GeneratorBasedBuilder):
|
|
| 87 |
def _split_generators(self, dl_manager):
|
| 88 |
train_text = dl_manager.download_and_extract("rumoureval2019_train.csv")
|
| 89 |
validation_text = dl_manager.download_and_extract("rumoureval2019_val.csv")
|
|
|
|
| 90 |
return [
|
| 91 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_text, "split": "train"}),
|
| 92 |
-
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": validation_text, "split": "validation"})
|
|
|
|
| 93 |
]
|
| 94 |
|
| 95 |
-
# method parameters are unpacked from `gen_kwargs` as given in `_split_generators`
|
| 96 |
def _generate_examples(self, filepath, split):
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
instance['id'] = str(guid)
|
| 108 |
-
yield guid, instance
|
| 109 |
-
guid += 1
|
|
|
|
| 51 |
super(RumourEval2019Config, self).__init__(**kwargs)
|
| 52 |
|
| 53 |
class RumourEval2019(datasets.GeneratorBasedBuilder):
|
| 54 |
+
"""RumourEval2019 Stance Detection Dataset formatted in triples of (source_text, reply_text, label)"""
|
| 55 |
|
| 56 |
VERSION = datasets.Version("0.9.0")
|
| 57 |
|
| 58 |
BUILDER_CONFIGS = [
|
| 59 |
+
RumourEval2019Config(name="RumourEval2019", version=VERSION, description="Stance Detection Dataset"),
|
| 60 |
]
|
| 61 |
|
| 62 |
def _info(self):
|
|
|
|
| 87 |
def _split_generators(self, dl_manager):
|
| 88 |
train_text = dl_manager.download_and_extract("rumoureval2019_train.csv")
|
| 89 |
validation_text = dl_manager.download_and_extract("rumoureval2019_val.csv")
|
| 90 |
+
test_text = dl_manager.download_and_extract("rumoureval2019_test.csv")
|
| 91 |
return [
|
| 92 |
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": train_text, "split": "train"}),
|
| 93 |
+
datasets.SplitGenerator(name=datasets.Split.VALIDATION, gen_kwargs={"filepath": validation_text, "split": "validation"}),
|
| 94 |
+
datasets.SplitGenerator(name=datasets.Split.TEST, gen_kwargs={"filepath": test_text, "split": "test"}),
|
| 95 |
]
|
| 96 |
|
|
|
|
| 97 |
def _generate_examples(self, filepath, split):
|
| 98 |
+
with open(filepath, encoding="utf-8") as f:
|
| 99 |
+
reader = csv.DictReader(f, delimiter=",")
|
| 100 |
+
guid = 0
|
| 101 |
+
for instance in reader:
|
| 102 |
+
instance["source_text"] = instance.pop("source_text")
|
| 103 |
+
instance["reply_text"] = instance.pop("reply_text")
|
| 104 |
+
instance["label"] = instance.pop("label")
|
| 105 |
+
instance['id'] = str(guid)
|
| 106 |
+
yield guid, instance
|
| 107 |
+
guid += 1
|
|
|
|
|
|
|
|
|