Four enhancements to make the editor fit real school usage:
- Per-document tone (academic/professional/casual/humorous/creative/
persuasive/general): new documents.tone column (migration 0002), threaded
through the docs API, a bilingual ToneSelect dropdown on the title row, and
injected into the grammar-checkpoint LLM prompt so advice fits the register.
The voice pass stays tone-agnostic.
- Right-click word lookup: a new offline `lexicon` package serves definitions
(Wordset, modern ESL-friendly glosses) and synonyms (WordNet synsets first,
then frequency+stopword-ranked Moby for breadth) from gzipped embedded data,
behind /api/word/{word} with light morphology. The WordCard popover shows the
definition and tappable synonym pills that swap the word in place.
- Expanded writing stats: clicking the word count opens a StatsPanel with page
count, sentences, paragraphs, reading time, average word length, word variety,
and Flesch-Kincaid reading level — all computed client-side.
Claude-Session: https://claude.ai/code/session_016Yr6jELuRc7hyzYLccQKZd
22 lines
952 B
Go
22 lines
952 B
Go
// Package lexicon serves offline word lookups — a definition and a list of
|
|
// synonyms for a single word — from two public-domain datasets compiled into the
|
|
// binary. Definitions come from the Wordset dictionary (modern, concise glosses
|
|
// with a part of speech and example, which read kindly for an ESL writer);
|
|
// synonyms come from the Moby Thesaurus. Both are gzipped JSON, decompressed
|
|
// lazily on first use so a writer who never right-clicks a word pays nothing.
|
|
package lexicon
|
|
|
|
import _ "embed"
|
|
|
|
// definitionsGz is the gzipped Wordset definitions map: word → [[pos, def,
|
|
// example], …], lowercase keys. Built by the data-prep step (see commit notes).
|
|
//
|
|
//go:embed data/definitions.json.gz
|
|
var definitionsGz []byte
|
|
|
|
// synonymsGz is the gzipped Moby thesaurus map: headword → [synonym, …],
|
|
// lowercase keys, capped per word to keep the popover (and the binary) small.
|
|
//
|
|
//go:embed data/synonyms.json.gz
|
|
var synonymsGz []byte
|