Datasets:
Commit
·
360981e
1
Parent(s):
37ab06f
Update README.md
Browse files
README.md
CHANGED
|
@@ -28,6 +28,28 @@ from datasets import load_dataset
|
|
| 28 |
dataset = load_dataset("batterydata/battery-device-data-qa")
|
| 29 |
```
|
| 30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
# Citation
|
| 32 |
```
|
| 33 |
@article{huang2022batterybert,
|
|
|
|
| 28 |
dataset = load_dataset("batterydata/battery-device-data-qa")
|
| 29 |
```
|
| 30 |
|
| 31 |
+
Note: in the original BatteryBERT paper, 272 data records were used for evaluation after removing redundant records as well as paragraphs with character length >= 1500. Code is shown below:
|
| 32 |
+
```
|
| 33 |
+
import json
|
| 34 |
+
with open("answers.json", "r", encoding='utf-8') as f:
|
| 35 |
+
data = json.load(f)
|
| 36 |
+
|
| 37 |
+
evaluation = []
|
| 38 |
+
for point in data['data']:
|
| 39 |
+
paragraphs = point['paragraphs'][0]['context']
|
| 40 |
+
if len(paragraphs)<1500:
|
| 41 |
+
qas = point['paragraphs'][0]['qas']
|
| 42 |
+
for indiv in qas:
|
| 43 |
+
try:
|
| 44 |
+
question = indiv['question']
|
| 45 |
+
answer = indiv['answers'][0]['text']
|
| 46 |
+
pairs = (paragraphs, question, answer)
|
| 47 |
+
evaluation.append(pairs)
|
| 48 |
+
except:
|
| 49 |
+
continue
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
|
| 53 |
# Citation
|
| 54 |
```
|
| 55 |
@article{huang2022batterybert,
|