ruanchaves commited on
Commit
48c90a6
·
1 Parent(s): f668dc9

feat: reli

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