Skip to content

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

Open
alex-rawlings-yyc wants to merge 1 commit into
mainfrom
feat/313-dedupe-pt9-payloads
Open

alex-rawlings-yyc wants to merge 1 commit 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 there is one, 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: a87cc347-2014-4b70-a1cf-e496177174df

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

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

1 participant