Files
church-translate/app/_test-lexicon.js
christianandClaude Opus 5 c9eef0672c Church Translate, as it runs at the campuses
Live sermon translation into 100+ languages, running entirely on one Mac per
campus: audio in, voice detection, Whisper on the GPU, NLLB-200 in its own
process, and a built-in web server the congregation reads from on their
phones. No audio leaves the building.

This is the source only. What used to sit beside it — 14 GB of speech and
translation models, 8 GB of voice bundles, 6 GB of natural voices, the Electron
caches, and the app data holding the operator PIN and every service transcript
— is machine state and downloaded assets, and stays in the NAS backup where it
belongs. The vendored node, cloudflared and Windows ffmpeg binaries are out too
(533 MB, re-fetched for packaging); the browser-side runtime beside them is
kept, so a checkout still serves the congregation page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 15:41:21 -04:00

23 lines
1.2 KiB
JavaScript

/* Run the lexicon over 5,954 rows of real Spanish output and inspect EVERY
change. A lexicon that corrupts correct Spanish is worse than no lexicon. */
const fs=require('fs'), vm=require('vm');
const B=require('./bible-lexicon.js');
const src=fs.readFileSync('engine.js','utf8');
const sb={console};vm.createContext(sb);
vm.runInContext(src.slice(src.indexOf('const SCRIPT_NO_SPACES'), src.indexOf('function applyFixes')), sb);
const rows=require('/tmp/es-corpus.json');
const bl=B.forLanguage('spa_Latn');
const pairs=Object.keys(bl).map(from=>({from,to:bl[from]}));
let n=0; const seen={};
for (const r of rows){
const es=String((r.tr&&r.tr.spa_Latn)||''); if(!es) continue;
const out=sb.applyTable(es,pairs);
if(out===es) continue; n++;
const a=es.split(/\s+/),b=out.split(/\s+/),d=[];
for(let i=0;i<Math.max(a.length,b.length);i++) if(a[i]!==b[i]) d.push((a[i]||'')+' -> '+(b[i]||''));
const k=d.join(' | '); seen[k]=(seen[k]||0)+1;
}
console.log('rows changed by the lexicon: '+n+' ('+(n/rows.length*100).toFixed(2)+'%)\n');
console.log('EVERY change:');
Object.entries(seen).sort((a,b)=>b[1]-a[1]).forEach(([d,c])=>console.log(' '+String(c).padStart(3)+'x '+d));