Skip to content

Merge duplicate token analyses on PT9 import (#313) - #392

Merged
alex-rawlings-yyc merged 3 commits into
mainfrom
feat/313-dedupe-pt9-payloads
Oct 5, 2026
Merged

alex-rawlings-yyc merged 3 commits into
mainfrom
feat/313-dedupe-pt9-payloads

Conversation

@alex-rawlings-yyc

@alex-rawlings-yyc alex-rawlings-yyc commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #313.

Summary

  • PT9 import merges token analyses with identical content into one, the same way hand-glossing already does. This uses the analysesAreIdentical rule, so surface forms differing only in case also merge. It covers both analyses from interlinear clusters and the unlinked ones from the word-analysis inventories.
  • Every link to a dropped duplicate moves to the analysis that is kept, and keeps its own token's surface text, so drift detection stays per token.
  • If merging leaves one token with two links to the same analysis, only one is kept: the approved one if either is approved, a rejected one only if both are rejected, otherwise the first.
  • The import report has a new merge.identicalPayloadsMerged count. The import modal doesn't show it.

buildBareWordAnalyses keeps its own duplicate check, so skippedExistingIdentical still counts what it did. The merge runs after every other conversion step, so analyses made identical by #324's blank-morpheme stripping will merge too.

Out of scope: a merged analysis shows the surface text of whichever token came first, e.g. a capitalized sentence-initial form; deriving the displayed form from its links belongs to #186. PT9 import still writes one phrase payload per occurrence; that has its own issue.

Test plan

  • Unit tests for merging duplicates and moving their links, an unlinked analysis matching a linked one, case variants, the three near-misses that must stay apart (different gloss, breakdown vs. none, different breakdown), and the one-link-per-token rule; 100% coverage
  • Import PIA (test-data/pt9-projects/PIA): the four plovs tokens in PHP 1:6-7 end up on three analyses, with the two "catorce / plov s" occurrences sharing one
  • The catalog shows that analysis as one row with two uses, and the plovs suggestion dropdown has no duplicate rows

This change is Reviewable

@coderabbitai

coderabbitai Bot commented Oct 1, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 646a5138-8a0a-4825-b391-62cc15db058d
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jasonleenaylor jasonleenaylor 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.

Nit, not blocking: test-data/pt9-projects/README.md:66 still says the plovs pool key gets four competing payloads; with this merge it's three (as your test plan says).

This review was assisted by Claude Opus 5.5.

Comment thread src/converters/pt9/tokenAnalysisDedupe.ts Outdated

@alex-rawlings-yyc alex-rawlings-yyc left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@alex-rawlings-yyc made 2 comments.
Reviewable status: 0 of 10 files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).

Comment thread src/converters/pt9/tokenAnalysisDedupe.ts Outdated

@jasonleenaylor jasonleenaylor 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.

@jasonleenaylor reviewed 10 files and all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).

@alex-rawlings-yyc
alex-rawlings-yyc merged commit 18093d0 into main Oct 5, 2026
13 of 14 checks passed
@alex-rawlings-yyc
alex-rawlings-yyc deleted the feat/313-dedupe-pt9-payloads branch October 5, 2026 22:43
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.

Dedupe identical token analysis payloads on PT9 import

2 participants