AilinWhiteNight
commited on
Commit
•
5c75fd7
1
Parent(s):
2e2a2b7
upload base information
Browse files
README.md
CHANGED
@@ -29,3 +29,144 @@ configs:
|
|
29 |
- split: test
|
30 |
path: data/test-*
|
31 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
- split: test
|
30 |
path: data/test-*
|
31 |
---
|
32 |
+
# Dataset Detail
|
33 |
+
this dataset is processed from 3 source of thai dataset consist of
|
34 |
+
- miracl/miracl
|
35 |
+
- facebook/xnli
|
36 |
+
- castorini/mr-tydi
|
37 |
+
- castorini/mr-tydi-corpus
|
38 |
+
## processing script
|
39 |
+
here is the precessing script I use
|
40 |
+
### miracl/miracl
|
41 |
+
```python
|
42 |
+
def create_miracl_datasets(datasets):
|
43 |
+
"""
|
44 |
+
nothing just extract texts
|
45 |
+
"""
|
46 |
+
datasets_ = {
|
47 |
+
'query': [],
|
48 |
+
'positive_passages': [],
|
49 |
+
'negative_passages': [],
|
50 |
+
}
|
51 |
+
for data in tqdm(datasets):
|
52 |
+
datasets_['query'].append(data['query'])
|
53 |
+
negative_passages = []
|
54 |
+
for negative_passage in data['negative_passages']:
|
55 |
+
negative_passages.append(negative_passage['text'])
|
56 |
+
datasets_['negative_passages'].append(negative_passages)
|
57 |
+
positive_passages = []
|
58 |
+
for positive_passage in data['positive_passages']:
|
59 |
+
positive_passages.append(positive_passage['text'])
|
60 |
+
datasets_['positive_passages'].append(positive_passages)
|
61 |
+
return Dataset.from_dict(datasets_)
|
62 |
+
```
|
63 |
+
ratio
|
64 |
+
```python
|
65 |
+
DatasetDict({
|
66 |
+
train: Dataset({
|
67 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
68 |
+
num_rows: 2972
|
69 |
+
})
|
70 |
+
eval: Dataset({
|
71 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
72 |
+
num_rows: 366
|
73 |
+
})
|
74 |
+
test: Dataset({
|
75 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
76 |
+
num_rows: 367
|
77 |
+
})
|
78 |
+
})
|
79 |
+
```
|
80 |
+
|
81 |
+
### facebook/xnli
|
82 |
+
```python
|
83 |
+
def create_xnli_datasets(datasets):
|
84 |
+
"""
|
85 |
+
transform format of ['premise', 'hypothesis', 'label'] to ['query', 'positive_passages', 'negative_passages']
|
86 |
+
using contradiction as negative passage pair and
|
87 |
+
neutral, entailment -> possitive passage pair
|
88 |
+
premise as passage (premise -> evidence)
|
89 |
+
hypothesis as query (hypothesis so called question so can be used as query)
|
90 |
+
"""
|
91 |
+
datasets_ = {
|
92 |
+
'query': [],
|
93 |
+
'positive_passages': [],
|
94 |
+
'negative_passages': []
|
95 |
+
}
|
96 |
+
for data in tqdm(datasets):
|
97 |
+
datasets_['query'].append(data['premise'])
|
98 |
+
if data['label'] == 'contradiction':
|
99 |
+
datasets_['positive_passages'].append([])
|
100 |
+
datasets_['negative_passages'].append([data['hypothesis']])
|
101 |
+
elif data['label'] == 'neutral' or 'entailment':
|
102 |
+
datasets_['positive_passages'].append([data['hypothesis']])
|
103 |
+
datasets_['negative_passages'].append([])
|
104 |
+
return Dataset.from_dict(datasets_)
|
105 |
+
```
|
106 |
+
ratio
|
107 |
+
```python
|
108 |
+
DatasetDict({
|
109 |
+
train: Dataset({
|
110 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
111 |
+
num_rows: 392702
|
112 |
+
})
|
113 |
+
eval: Dataset({
|
114 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
115 |
+
num_rows: 2490
|
116 |
+
})
|
117 |
+
test: Dataset({
|
118 |
+
features: ['query', 'positive_passages', 'negative_passages'],
|
119 |
+
num_rows: 5010
|
120 |
+
})
|
121 |
+
})
|
122 |
+
```
|
123 |
+
|
124 |
+
### castorini/mr-tydi
|
125 |
+
```python
|
126 |
+
def create_tydi_datasets(datasets, corpus, train = False):
|
127 |
+
"""
|
128 |
+
both dev, test set have only docid which may can be retrieve from the corpus
|
129 |
+
"""
|
130 |
+
cor_df = corpus.to_pandas()
|
131 |
+
datasets_ = {
|
132 |
+
'query': [],
|
133 |
+
'positive_passages': [],
|
134 |
+
'negative_passages': [],
|
135 |
+
}
|
136 |
+
for data in tqdm(datasets):
|
137 |
+
datasets_['query'].append(data['query'])
|
138 |
+
if train:
|
139 |
+
negative_passages = []
|
140 |
+
for negative_passage in data['negative_passages']:
|
141 |
+
negative_passages.append(negative_passage['text'])
|
142 |
+
datasets_['negative_passages'].append(negative_passages)
|
143 |
+
else:
|
144 |
+
datasets_['negative_passages'].append([])
|
145 |
+
positive_passages = []
|
146 |
+
for positive_passage in data['positive_passages']:
|
147 |
+
search_value = positive_passage['docid']
|
148 |
+
text = cor_df[cor_df["docid"] == search_value].text.values[0]
|
149 |
+
# if text.empty:
|
150 |
+
# continue
|
151 |
+
positive_passages.append(text)
|
152 |
+
datasets_['positive_passages'].append(positive_passages)
|
153 |
+
return Dataset.from_dict(datasets_)
|
154 |
+
```
|
155 |
+
|
156 |
+
ratio
|
157 |
+
```python
|
158 |
+
DatasetDict({
|
159 |
+
train: Dataset({
|
160 |
+
features: ['query_id', 'query', 'positive_passages', 'negative_passages'],
|
161 |
+
num_rows: 3319
|
162 |
+
})
|
163 |
+
dev: Dataset({
|
164 |
+
features: ['query_id', 'query', 'positive_passages', 'negative_passages'],
|
165 |
+
num_rows: 807
|
166 |
+
})
|
167 |
+
test: Dataset({
|
168 |
+
features: ['query_id', 'query', 'positive_passages', 'negative_passages'],
|
169 |
+
num_rows: 1190
|
170 |
+
})
|
171 |
+
})
|
172 |
+
```
|