Removed Jeopardy questions containing URLs. Including first letter in first hint.
This commit is contained in:
@@ -1,20 +1,28 @@
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs').promises;
|
||||
const linkify = require('linkify-it')();
|
||||
|
||||
const questions = require('./jeopardy_raw.json');
|
||||
|
||||
async function init() {
|
||||
const curatedQuestions = questions.map((question) => ({
|
||||
...question,
|
||||
question: question.question.replace(/^'|'$/g, ''),
|
||||
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"/gi, ''),
|
||||
fullAnswer: question.answer,
|
||||
const curatedQuestions = await Promise.all(questions.map(async (question) => {
|
||||
const links = linkify.match(question.question);
|
||||
|
||||
if (links?.length > 0 || /\[jpe?g\]/.test(question.question)) {
|
||||
console.log(`Discarding question due URL: ${question.question}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
...question,
|
||||
question: question.question.replace(/^'|'$/g, ''),
|
||||
answer: question.answer.replace(/^((the|an|a)\b(?!-)|\(.*\))\s*|\(.*\)$|"|\\/gi, ''),
|
||||
fullAnswer: question.answer,
|
||||
};
|
||||
}));
|
||||
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions, null, 4));
|
||||
|
||||
console.log(curatedQuestions);
|
||||
await fs.writeFile('assets/jeopardy.json', JSON.stringify(curatedQuestions.filter(Boolean), null, 4));
|
||||
}
|
||||
|
||||
init();
|
||||
|
||||
115264
assets/jeopardy.json
115264
assets/jeopardy.json
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user