-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathADI.py
60 lines (54 loc) · 1.59 KB
/
ADI.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import pandas as pd
from llmebench.datasets.dataset_base import DatasetBase
from llmebench.tasks import TaskType
class ADIDataset(DatasetBase):
def __init__(self, **kwargs):
super(ADIDataset, self).__init__(**kwargs)
@staticmethod
def get_data_sample():
return {"input": "some tweet", "label": "no_not_interesting"}
@staticmethod
def metadata():
return {
"language": "ar",
"citation": """TO DO: in house dataset""",
"splits": {
"dev": "fewshot_dev.tsv",
"test": "all_v2.tsv",
},
"task_type": TaskType.Classification,
"class_labels": [
"egy",
"ira",
"jor",
"ksa",
"kuw",
"leb",
"lib",
"mor",
"msa",
"pal",
"qat",
"sud",
"syr",
"uae",
"YEM",
],
}
def load_data(self, data_path):
data_path = self.resolve_path(data_path)
data = []
raw_data = pd.read_csv(data_path, sep="\t")
for index, row in raw_data.iterrows():
text = row["text"]
input_id = row["SegId"]
label = str(row["RefLabel"]).lower()
data.append(
{
"input": text,
"label": label,
"input_id": input_id,
"line_number": index,
}
)
return data