divan/api/src/dict-sync.ts
Anas Rashid 7fcc0ee7fa Word dictionary: full Wiktionary data for Urdu, Persian and Arabic in PostgreSQL, kept in sync
- en.wiktionary entries via kaikki.org (meanings, IPA, transliteration, audio, etymology, synonyms)
- ur./fa./ar.wiktionary dumps for meanings in each language (incl. more Urdu entry formats)
- English->Urdu pivot table from Urdu entries' glosses and ur.wiktionary's English entries
- dict-sync.ts: re-imports sources when upstream publishes new files, applies daily recent changes;
  run from deploy/sync.sh
- lookups now read the database (2-7 ms) instead of calling Wikimedia live

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-08 21:48:56 +02:00

11 lines
539 B
TypeScript

// Import / sync the Wiktionary data (see dictionary.ts). First run imports everything (about 1 GB of downloads);
// later runs re-import only sources that changed upstream and apply the day's Wiktionary edits.
// node src/dict-sync.ts
import { readFile } from 'node:fs/promises';
import { pool } from './db.ts';
import { sync } from './dictionary.ts';
await pool.query(await readFile(new URL('../../db/schema.sql', import.meta.url), 'utf8'));
await sync((line) => console.log(`${new Date().toISOString()} ${line}`));
await pool.end();