/* Verify the audit's claims against the REAL functions, not by reading. */ const fs=require('fs'), vm=require('vm'); const src=fs.readFileSync('engine.js','utf8'); const grab=(n)=>{const i=src.indexOf('function '+n+'(');let d=0;for(let k=src.indexOf('{',i);k /' + re.source + '/' + re.flags); } console.log(' consequence:'); for (const [term,hay] of [['Марк','Маркса продали'],['Иоанн','Иоанном говорил'],['الرب','الربا حرام']]) { const re=sb.termMatcher(term); re.lastIndex=0; const hit = sb.applyTable(hay,[{from:term,to:'<>'}]); console.log(' "'+hay+'" -> "'+hit+'"'); } console.log('\nCLAIM A2 — accented capitals fall through to case-INSENSITIVE'); for (const t of ['Éxodo','Ámos','Exodus']) { const re=sb.termMatcher(t); console.log(' '+t.padEnd(8)+' flags='+re.flags+(re.flags.includes('i')?' <-- matches lowercase too':'')); } console.log(' "el éxodo de los jóvenes" -> "' + sb.applyTable('el éxodo de los jóvenes',[{from:'Éxodo',to:'Exodo-BOOK'}]) + '"'); console.log('\nCLAIM A3 — 2-char CJK entries are unmatchable in running text'); for (const [term,hay] of [['约翰','约翰说了'],['摩西','摩西带领'],['哈巴谷书','向哈巴谷书第一章']]) { const out = sb.applyTable(hay,[{from:term,to:'<>'}]); console.log(' '+term.padEnd(6)+' in "'+hay+'" -> "'+out+'"'+(out===hay?' <-- DID NOT FIRE':'')); } console.log('\nCLAIM C1 — splitSentences glues short trailing sentences'); for (const s of ['God is good. Amen.','It cost 3.5 million.','Dr. King said God is good.','Jesus wept. Amen.']) { console.log(' "'+s+'"\n -> '+JSON.stringify(sb.splitSentences(s))); }