Files
Siteforge/scripts/fix-chatbot-titles.mjs

27 lines
1.2 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { readFileSync, writeFileSync } from 'fs'
const path = '/Users/nate.emmert/Documents/github/Siteforge/data/chatbot-content.json'
const data = JSON.parse(readFileSync(path, 'utf8'))
const fixes = {
2: { title: 'Episode 2 — Introduction to Titus (Background & Overview)', extra: ['introduction', 'background', 'overview', 'crete', 'letter'] },
5: { title: 'Episode 5 — The Danger of Empty Words (Titus 1:1013a)', extra: ['danger', 'empty', 'words', 'false', 'teacher', 'titus 1:10', 'titus 1:13'] },
6: { title: 'Episode 6 — Words That Deny What We Claim to Believe (Titus 1:13b16)', extra: ['deny', 'claim', 'believe', 'titus 1:13', 'titus 1:16'] },
14: { title: 'Episode 14 — Grace: Where It Starts and Where It Ends (Titus 3:1215)', extra: ['grace', 'starts', 'ends', 'review', 'titus 3:12', 'titus 3:15'] },
}
let count = 0
for (const entry of data) {
const m = entry.title.match(/^Episode (\d+)/)
if (!m) continue
const ep = Number(m[1])
if (fixes[ep]) {
entry.title = fixes[ep].title
entry.keywords = [...new Set([...entry.keywords, ...fixes[ep].extra])].slice(0, 20)
count++
}
}
writeFileSync(path, JSON.stringify(data, null, 2), 'utf8')
console.log(`Fixed ${count} entries. Total: ${data.length}`)