ruanchaves commited on
Commit
1aa55a9
1 Parent(s): 4ee1c6a

feat: rerelem

Browse files
Files changed (1) hide show
  1. rerelem.py +62 -0
rerelem.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """ReRelEM dataset"""
2
+
3
+ import datasets
4
+ import pandas as pd
5
+
6
+ _CITATION = """
7
+ """
8
+
9
+ _DESCRIPTION = """
10
+ """
11
+ _URLS = {
12
+ "train": "https://raw.githubusercontent.com/ruanchaves/rerelem/ad2eda398e974e15546251b10a34375dfa954edb/rerelem_train.csv",
13
+ "validation": "https://raw.githubusercontent.com/ruanchaves/rerelem/ad2eda398e974e15546251b10a34375dfa954edb/rerelem_val.csv",
14
+ "test": "https://raw.githubusercontent.com/ruanchaves/rerelem/ad2eda398e974e15546251b10a34375dfa954edb/rerelem_test.csv"
15
+ }
16
+
17
+ class ReRelEm(datasets.GeneratorBasedBuilder):
18
+
19
+ VERSION = datasets.Version("1.0.0")
20
+ def _info(self):
21
+ return datasets.DatasetInfo(
22
+ description=_DESCRIPTION,
23
+ features=datasets.Features(
24
+ {
25
+ "docid": datasets.Value("string"),
26
+ "sentence1": datasets.Value("string"),
27
+ "sentence2": datasets.Value("string"),
28
+ "label": datasets.Value("string"),
29
+ "same_text": datasets.Value("bool"),
30
+ }),
31
+ supervised_keys=None,
32
+ homepage="",
33
+ citation=_CITATION,
34
+ )
35
+
36
+ def _split_generators(self, dl_manager):
37
+ downloaded_files = dl_manager.download(_URLS)
38
+ return [
39
+ datasets.SplitGenerator(
40
+ name=datasets.Split.TRAIN,
41
+ gen_kwargs={
42
+ "filepath": downloaded_files["train"]
43
+ }
44
+ ),
45
+ datasets.SplitGenerator(
46
+ name=datasets.Split.VALIDATION,
47
+ gen_kwargs={
48
+ "filepath": downloaded_files["validation"]
49
+ }
50
+ ),
51
+ datasets.SplitGenerator(
52
+ name=datasets.Split.TEST,
53
+ gen_kwargs={
54
+ "filepath": downloaded_files["test"]
55
+ }
56
+ )
57
+ ]
58
+
59
+ def _generate_examples(self, filepath):
60
+ records = pd.read_csv(filepath).to_dict("records")
61
+ for idx, row in enumerate(records):
62
+ yield idx, row