2021-11-06 00:33:52 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const fs = require('fs').promises;
|
|
|
|
|
|
|
|
const questions = require('./jeopardy_raw.json');
|
|
|
|
|
|
|
|
async function init() {
|
|
|
|
const curatedQuestions = questions.map((question) => ({
|
|
|
|
...question,
|
|
|
|
question: question.question.replace(/^'|'$/g, ''),
|
2021-11-14 16:56:07 +00:00
|
|
|
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"/gi, ''),
|
|
|
|
fullAnswer: question.answer,
|
2021-11-06 00:33:52 +00:00
|
|
|
}));
|
|
|
|
|
2021-11-14 16:56:07 +00:00
|
|
|
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions, null, 4));
|
2021-11-06 00:33:52 +00:00
|
|
|
|
|
|
|
console.log(curatedQuestions);
|
|
|
|
}
|
|
|
|
|
|
|
|
init();
|