Additional morphism info added#23
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Finnish morphology tooltip to show a step-by-step derivation trace (base form → gradation → suffix) when available, while preserving the existing one-line fallback when a confident derivation can’t be built.
Changes:
- Extend the morphology port/result to optionally include a structured
derivation(summary + typed steps). - Add a pure derivation engine (
deriveInflection.ts) that parses VoikkoFSTOUTPUTand reconstructs gradation/suffix steps, plus Nodenode:testunit tests. - Update the reader tooltip UI to render the derivation steps (fallback to the prior one-line morphology summary).
Reviewed changes
Copilot reviewed 7 out of 8 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Enables importing TS extensions (used by the new Node test + TS import style). |
| src/modules/reader/components/TranslatableWord.tsx | Renders derivation steps in the tooltip when present; otherwise keeps existing morphology summary display. |
| src/modules/morphology/ports/MorphologyAnalyzer.ts | Adds Derivation / DerivationStep and MorphologyResult.derivation. |
| src/modules/morphology/adapters/FinnishMorphologyAnalyzer.ts | Wires resolved Voikko features into the derivation engine and returns derivation. |
| src/modules/morphology/adapters/deriveInflection.ts | New pure derivation engine (FST parse + gradation detection + step assembly). |
| src/modules/morphology/adapters/deriveInflection.test.ts | New node:test unit tests for the derivation engine. |
| package.json | Adds a test script intended to run the new unit tests. |
| .project/tasks/task-017_morphology-derivation-trace.md | Adds the implementation/task log describing the derivation feature and decisions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+208
to
+212
| const gradFragment = gradation ? `${gradation.from}→${gradation.to || '∅'} + ` : ''; | ||
| const shortMeaning = summaryTag(input); | ||
| const summary = | ||
| `${baseForm} · ${gradFragment}-${ending}` + (shortMeaning ? ` (${shortMeaning})` : ''); | ||
|
|
Comment on lines
+187
to
+194
| if (gradation && stem !== baseForm) { | ||
| steps.push({ | ||
| kind: 'gradation', | ||
| marker: gradationMarker(gradation), | ||
| detail: 'consonant gradation', | ||
| result: `${stem}-`, | ||
| }); | ||
| } |
Comment on lines
+45
to
+49
| const GRADATION_PAIRS: ReadonlyArray<readonly [string, string]> = [ | ||
| ['kk', 'k'], ['pp', 'p'], ['tt', 't'], | ||
| ['nk', 'ng'], ['mp', 'mm'], ['nt', 'nn'], ['lt', 'll'], ['rt', 'rr'], ['nk', 'ng'], | ||
| ['k', ''], ['p', 'v'], ['t', 'd'], | ||
| ]; |
Comment on lines
8
to
+10
| "start": "next start", | ||
| "lint": "next lint" | ||
| "lint": "next lint", | ||
| "test": "node --test \"src/**/*.test.ts\"" |
Comment on lines
+7
to
+9
| # Human Comment | ||
| I'm not 100% sure what I want. So I will go with this task first and check the output and let you know whether this task will need any changes after the implementaiton | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.