Skip to content

Additional morphism info added#23

Merged
MaheeGamage merged 2 commits into
mainfrom
feature/implement-v2
Jul 4, 2026
Merged

Additional morphism info added#23
MaheeGamage merged 2 commits into
mainfrom
feature/implement-v2

Conversation

@MaheeGamage

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2026 20:58
@vercel

vercel Bot commented Jul 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
finnish-learner Ready Ready Preview, Comment Jul 3, 2026 8:59pm

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 Voikko FSTOUTPUT and reconstructs gradation/suffix steps, plus Node node:test unit 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 thread package.json
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

@MaheeGamage
MaheeGamage merged commit 2731d96 into main Jul 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants