44 lines
1.5 KiB
JavaScript
44 lines
1.5 KiB
JavaScript
import { pipeline, env } from '@huggingface/transformers';
|
|||
|
|
import os from 'os'; import path from 'path';
|
||
|
|
env.allowLocalModels=false;
|
||
|
|
env.cacheDir=path.join(os.homedir(),'Library/Application Support/Church Translate Models');
|
||
|
|
const pipe=await pipeline('translation','Xenova/nllb-200-distilled-600M',{dtype:'fp32'});
|
||
|
|
const say=async(t,l='spa_Latn')=>{const o=await pipe(t,{src_lang:'eng_Latn',tgt_lang:l});return (Array.isArray(o)?o[0]:o).translation_text.trim();};
|
||
|
|
|
||
|
|
/* Real preaching idioms. The question for each is not "is it good Spanish" but
|
||
|
|
"did the MEANING survive" — a fluent wrong answer is the dangerous case. */
|
||
|
|
const IDIOMS=[
|
||
|
|
'Open up to the book of John.',
|
||
|
|
'Open up to John chapter three.',
|
||
|
|
'Open up your Bibles.',
|
||
|
|
'Turn with me to John chapter three.',
|
||
|
|
'Look at verse four with me.',
|
||
|
|
'Drop down to verse ten.',
|
||
|
|
'Back up to verse one.',
|
||
|
|
'Come on, somebody.',
|
||
|
|
'Give God a hand of praise.',
|
||
|
|
'Put a hand on your neighbor.',
|
||
|
|
'Say it with me.',
|
||
|
|
'Can somebody say amen.',
|
||
|
|
'I want you to catch this.',
|
||
|
|
'Watch this.',
|
||
|
|
'Are you tracking with me.',
|
||
|
|
'That will preach.',
|
||
|
|
'He is a good good Father.',
|
||
|
|
'God showed up.',
|
||
|
|
'The enemy is defeated.',
|
||
|
|
'Walk it out.',
|
||
|
|
'Let that sink in.',
|
||
|
|
'Write this down.',
|
||
|
|
'Circle that in your Bible.',
|
||
|
|
'Underline that word.',
|
||
|
|
'We are going to camp out here for a minute.',
|
||
|
|
'Let me unpack that for you.',
|
||
|
|
'Turn the page.',
|
||
|
|
'Stand to your feet.',
|
||
|
|
'Bow your heads with me.'
|
||
|
|
];
|
||
|
|
console.log('idiom -> Spanish');
|
||
|
|
console.log('='.repeat(70));
|
||
|
|
for (const t of IDIOMS) console.log(' '+t+'\n '+await say(t));
|