migrate to root dir

This commit is contained in:
2025-08-08 19:26:21 +02:00
parent cf8219691b
commit 8720500442
41 changed files with 2478 additions and 4440 deletions

20
lib/pipeline/sanitizer.ts Normal file
View File

@@ -0,0 +1,20 @@
import * as fs from "fs";
import * as path from "path";
const FORBIDDEN_WORDS = ["darn", "heck", "gosh"];
export function sanitizeText(storyName: string): string {
const sourcePath = path.join("stories", storyName, "source.txt");
if (!fs.existsSync(sourcePath)) {
throw new Error(`Source text not found for story: ${storyName}`);
}
let text = fs.readFileSync(sourcePath, "utf8");
FORBIDDEN_WORDS.forEach((word) => {
const regex = new RegExp(`\\b${word}\\b`, "gi");
text = text.replace(regex, "***");
});
return text;
}