text-processing-utils/test-som.mjs
2026-01-21 11:37:27 -08:00

20 lines
659 B
JavaScript

import { SpellChecker } from './dist/spellcheck/index.js';
const spellChecker = new SpellChecker({
dictionaries: ['english', 'technical'],
customWords: ['vitest', 'uwuapps'],
autoCorrect: true,
threshold: 0.3
});
await spellChecker.initialize();
// Test 'som' alone
const somResult = await spellChecker.check('som');
console.log('som check result:', JSON.stringify(somResult, null, 2));
// Test the full text
const text = 'This is a test with som mispeled words';
const result = await spellChecker.checkText(text);
console.log('\ncheckText errors:', result.errors.map(e => e.word));
console.log('\nFull result:', JSON.stringify(result, null, 2));