Inflected words resolve: the Deinflector and Candidate ranking #11
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mobrule/kurageyomi#11
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Parent
#1
What to build
Tapping 食べさせられなかった finds 食べる.
The deinflection rule table is lifted from 10ten Japanese Reader (
src/background/deinflect.ts, GPL-3.0) along with its existing test suite, rather than written fresh (ADR 0002). Attribution stays with the code and the licence stays GPL-3.0.From the tap point the Lookup takes the text forward to a 16-character cap and shortens it one character at a time, running every substring through the deinflector. Each result is a Candidate: a Headword, the Reason Chain that reached it, and the length of text it consumed. All Candidates from one tap go to the plugin in a single request.
Two things then happen in the browser, and neither belongs on the server (ADR 0006):
The winning Entry appears in the sheet with its Reason Chain shown, so the reader can see which inflections were undone and in what order.
The 16-character cap is Yomitan's number, taken rather than invented (ADR 0005).
Acceptance criteria
Blocked by
Merged to
mainin168b131.The 10ten deinflection table and its test suite were lifted, not written: 628 of 629 lines of
deinflect.tsand 561 of 562 of its tests are byte-identical to upstream, verified by re-downloading and diffing. Attribution intact, GPL-3.0 unchanged.16-character scan from the tap point, Candidates carrying Reason Chain and consumed length, one batched request per tap, word-class filtering that drops Candidates the Entry contradicts, and ranking by consumed length rather than matched-Headword length. The Reason Chain is rendered in the sheet.
The ranking test was verified to go red when the comparison is swapped to Headword length — a suite that passes under both rules would not have tested the thing that matters.
One thing ADR 0002 did not anticipate: the lifted file imports
@birchill/normal-jp, which publishes no licence anywhere — noLICENSEin its repo, nolicensefield on npm (independently confirmed). Under ADR 0004 it could not be adopted, soweb/src/kana.tssupplies its one function in ~12 lines with its own tests. Recorded as a Consequences bullet on ADR 0002.