feat(wordlens): trim hints to first sense + suppress known derivations (#4635)
* refactor(wordlens): rename ww-gloss CSS class to wl-gloss Completes the Word Wise → Word Lens rename (#4633) for the gloss ruby class — the 'ww' shorthand was missed. Renamed consistently across the apply site (GLOSS_CLASS), the CSS rules in style.ts, the tap hit-test in iframeEventHandlers, and the browser tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * feat(wordlens): trim hints to first sense + suppress known derivations Runtime, best-effort gloss-quality pass over the shipped en-zh pack (no regeneration): - cleanGloss: strip leading POS tags (now incl. 6-letter `interj.`) and keep only the first sense, so hints stay short — "Ahem" shows 呃哼, not "interj. 呃哼"; multi-sense entries collapse to their first sense. - Derivational reduction (English source only): a would-be-glossed word inherits a known base form's lower rank when the base exists in the pack AND their glosses share meaning, so lazily/shyly/sorrowful/downwards/inwards stop being hinted once lazy/shy/sorrow/… are known. Drifted forms keep their own rank because their gloss doesn't overlap the base (hardly≠hard, lately≠late). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(wordlens): note hint-quality layer + wl-gloss in agent memory Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -252,7 +252,7 @@ export const handleClick = (
|
||||
// after the drag/long-hold guards so only a clean single tap triggers it.
|
||||
const glossWord = findGlossWord(element);
|
||||
if (glossWord) {
|
||||
const ruby = element?.closest('ruby.ww-gloss') ?? null;
|
||||
const ruby = element?.closest('ruby.wl-gloss') ?? null;
|
||||
eventDispatcher.dispatch('wordlens-dictionary', { bookKey, element: ruby, word: glossWord });
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { GlossOccurrence } from '@/services/wordlens/types';
|
||||
|
||||
const GLOSS_CLASS = 'ww-gloss';
|
||||
const GLOSS_CLASS = 'wl-gloss';
|
||||
|
||||
interface Segment {
|
||||
node: Text;
|
||||
@@ -77,7 +77,7 @@ const occurrenceRange = (
|
||||
return range;
|
||||
};
|
||||
|
||||
/** Wrap each occurrence as <ruby class=ww-gloss cfi-skip>word<rt cfi-inert>gloss</rt></ruby>. */
|
||||
/** Wrap each occurrence as <ruby class=wl-gloss cfi-skip>word<rt cfi-inert>gloss</rt></ruby>. */
|
||||
export const applyGlosses = (
|
||||
doc: Document,
|
||||
model: SectionTextModel,
|
||||
|
||||
Reference in New Issue
Block a user