text-processing-utils/test-debug.js

25 lines
758 B
JavaScript
Raw Permalink Normal View History

2026-01-21 11:37:27 -08:00
import { SpellChecker } from './dist/spellcheck/index.js';
async function test() {
const spellChecker = new SpellChecker({
dictionaries: ['english', 'technical'],
customWords: ['vitest', 'uwuapps'],
autoCorrect: true,
threshold: 0.3
});
await spellChecker.initialize();
const text = 'This is a test with som mispeled words';
const result = await spellChecker.checkText(text);
console.log('Total errors:', result.errors.length);
console.log('Error words:', result.errors.map(e => e.word));
console.log('Full errors:', JSON.stringify(result.errors, null, 2));
// Also test just 'som' alone
const somResult = await spellChecker.check('som');
console.log('som check result:', somResult);
}
test().catch(console.error);