feat(baoyu-translate): add --output-dir to chunk.ts and improve refined workflow

- chunk.ts: add --output-dir option so chunks write to output directory instead of source directory
- Refined workflow: split Review into Critical Review + Revision (5→6 steps)
- Add Europeanized language diagnosis for CJK targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jim Liu 宝玉
2026-03-05 20:53:54 -06:00
parent 9f76a96741
commit f2c914887a
3 changed files with 102 additions and 43 deletions
+2 -1
View File
@@ -10,6 +10,7 @@ import type { Root, Content } from "mdast"
const args = process.argv.slice(2)
const file = args.find(a => !a.startsWith("--"))
const maxWords = parseInt(args[args.indexOf("--max-words") + 1] || "5000")
const outputDir = args.indexOf("--output-dir") !== -1 ? args[args.indexOf("--output-dir") + 1] : ""
if (!file) {
console.error("Usage: chunk.ts <file> [--max-words 5000]")
@@ -114,7 +115,7 @@ for (const b of blocks) {
}
if (cur.length > 0) chunks.push({ blocks: cur, words: curWords })
const dir = join(dirname(file), "chunks")
const dir = outputDir ? join(outputDir, "chunks") : join(dirname(file), "chunks")
mkdirSync(dir, { recursive: true })
chunks.forEach((chunk, i) => {