15 Commits

Author SHA1 Message Date
prosolis
f5e8f96e17 Tighten TestWords to acknowledge variant seed data and test combined filters
Variant words from seedTestData were silently inflating TestWords counts.
Comments now track them explicitly, and a new combined filter test verifies
variant + frequency + length compose correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 15:36:00 -07:00
prosolis
f3b1004599 Add variant tests and fix seed data for regional spelling coverage
- Seed color/colour with us/gb variants in test data
- Add TestWordVariant: verifies us, gb, common, pt-PT, and missing words
- Add TestVariantFilter: tests RandomWord and Words with variant param
- Update TestWords counts for new seeded variant words

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 15:30:34 -07:00
prosolis
704c06f41d Add regional variant tagging (us/gb) for English words
- SCOWL loader now loads american-words and british-words alongside
  english-words, tagging each with variant "us", "gb", or NULL (common)
- Words appearing in both American and British lists get NULL variant
- Add variant column to words table with schema migration
- API: /define returns variant field for English, /random and /words
  accept ?variant=us|gb filter
- Add total word count to server status line
- Fix rows.Close leak in PopulateCMUTails, add rows.Err() check
- Add tests for PopulateCMUTails, cmuTail, TotalWordCount
- Expand test seed data and assertions to cover pt-PT definitions,
  synonyms, and validity checks
- Update README with variant docs, /difficulty, /words, /rhyme
  endpoints, and current database statistics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 15:21:27 -07:00
prosolis
28ec11ba4e Consolidate word filtering into shared isJunkWord helper
Replace copy-pasted hasLetter/containsDigit/containsSpace/containsNonLatin
checks across 9 loaders with a single isJunkWord() call. SCOWL and CEDICT
keep their own filtering for valid reasons (SCOWL rejects hyphens/apostrophes,
CEDICT handles non-Latin Chinese characters).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 20:01:02 -07:00
prosolis
aff583dc28 Prune ghost words from affix expansion and stop frequency loader creating words
- Add PruneOrphanWords post-import step that deletes words with no
  definitions, synonyms, translations, pronunciations, etymology,
  synsets, or frequency data
- Remove INSERT path from CETEMPublico loader — frequency data should
  annotate existing words, not create new ones (was inflating pt-PT
  from 136K real words to 718K)
- Add hasLetter filter to hunspell, affix, and dicionario loaders to
  block punctuation entries like ".", ",", "(" from entering the DB
- Move hasLetter helper to scowl.go alongside other shared filters

Impact: en 655K→129K, pt-PT 1.5M→136K, fr 80K→56K (on reimport)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 19:55:37 -07:00
prosolis
2045cc2ada Add loader tests and fix header detection and punctuation filtering
Tests: 23 new tests across cetempublico, affix, and wiktionary loaders
covering column order detection, ISO-8859-1 encoding, junk filtering,
frequency scaling, affix expansion, and sense-level synonym extraction.

Fixes: header detection now checks either field for numeric value (was
only checking last field, breaking count-first format). Added hasLetter
filter to reject pure punctuation entries like "." and ",".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 09:15:13 -07:00
prosolis
a0cca2cb19 Rewrite README for public release
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 09:02:26 -07:00
prosolis
56e073f753 Add bearer token auth and clean up debug logging
- Bearer token auth via --token flag or DREAMDICT_TOKEN env var
- Timing-safe comparison with crypto/subtle
- /health exempt for monitoring without credentials
- 401 response for missing/invalid tokens
- Auth disabled when no token configured (backwards compatible)
- Remove debug logging from cetempublico loader

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 08:54:40 -07:00
prosolis
2cc1832439 Fix Portuguese coverage gaps: synonyms, translations, frequency, gerunds
- Extract sense-level synonyms/antonyms from Wiktionary (not just top-level),
  dramatically improving Portuguese synonym coverage
- Add bidirectional translation lookup so pt→en queries find en→pt entries
  stored by English Wiktionary loader, with reverse index for performance
- Fix frequency loader: auto-detect column order (count\tword vs word\tcount),
  auto-detect ISO-8859-1 encoding and convert to UTF-8, insert missing words
  instead of only updating existing ones
- Switch WordNet download from 3.1 to 3.0 to match WOLF/OMW synset offsets
- Add OpenSubtitles-derived Portuguese frequency list (hermitdave/FrequencyWords)
- Increase affix expansion cap from 30→80 forms per word for Portuguese gerunds

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 08:48:22 -07:00
prosolis
25ed087c3e Add /difficulty and /rhyme endpoints, CMU tail migration for rhyme matching
New /difficulty endpoint returns word difficulty scores (0.0-1.0).
New /rhyme endpoint uses CMU phoneme tail matching to find rhyming words,
sorted by frequency. Adds cmu_tail column migration with batch population
at startup, and index for efficient reverse lookups.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 06:45:29 -07:00
prosolis
207086da08 Add Phase 2+3 features: antonyms, backing, pronunciation, etymology, difficulty, affix expansion
New endpoints: /antonyms, /backing, /pronunciation, /etymology with difficulty
scoring on /random. Cross-language synset backing links French/Portuguese words
to English equivalents via WordNet 3.0 synset IDs (matching WOLF and OMW offsets).

New loaders: Hunspell affix expansion (fr, pt-PT), English programmatic inflector,
CMU Pronouncing Dictionary, SUBTLEX-US frequency, CETEMPúblico frequency,
Open Multilingual Wordnet (Portuguese), and SQL-based difficulty scoring.

Schema v2 adds tables: antonyms, synsets, word_synsets, pronunciations, etymology
with migration support for existing databases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 01:01:06 -07:00
prosolis
d5e4ce0d36 Add live status line and frequency batch endpoint
Display query count, error count, req/s, uptime, and last endpoint
hit on a single updating line to stdout. Also wire up the
/frequency/batch route that was missing from the mux.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 20:01:51 -07:00
prosolis
eb471b6f6d Add word frequency endpoint and SCOWL frequency data
SCOWL loader now sets frequency based on tier (10=1000 most common,
70=50 rare). New GET /frequency?word=X&lang=Y endpoint returns frequency
score for a word. Enables downstream consumers to identify rare/
sophisticated vocabulary from dictionary data rather than LLM guessing.

Also fix .gitignore matching cmd/server/ directory instead of just the
server binary.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 21:27:45 -07:00
prosolis
5b1eea67f2 Add Mandarin (zh) language support
Add CC-CEDICT loader and Wiktionary Chinese as data sources for
Mandarin. Also fix all Wiktionary download sections to retain
compressed archives and save checksums for integrity verification.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 17:20:14 -07:00
prosolis
eeea8d4d34 Initial commit: DreamDict HTTP dictionary service
Go-based dictionary backend providing word validation, definitions, synonyms,
and cross-language translation for English, French, and Portuguese. Designed
as a self-hosted replacement for Wordnik, backing GogoBee.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-28 16:57:40 -07:00