Skip to content

Comments

Add Interlinearization model, PT9 refactor, and viewing-mode support#11

Closed
alex-rawlings-yyc wants to merge 7 commits intomainfrom
interlinearization-model
Closed

Add Interlinearization model, PT9 refactor, and viewing-mode support#11
alex-rawlings-yyc wants to merge 7 commits intomainfrom
interlinearization-model

Conversation

@alex-rawlings-yyc
Copy link
Contributor

@alex-rawlings-yyc alex-rawlings-yyc commented Feb 19, 2026

  • Introduce Interlinearization data model.
  • Move internal-only PT9 types to dedicated file and change case of props.
  • Removed ScrTextName prop as it's been deprecated in PT9 since 2020.
  • Enhance interlinearizer WebView to support switching between viewing modes: InterlinearData and Interlinearization.
  • Update Jest configuration to include path aliases for types and parsers.
  • Modify README to clarify the structure of the src/types/ and src/parsers/ directories.
  • Rename interlinearXmlParser and related tests to paratext9parser.
  • Add new words to cspell configuration for improved spell checking.

This change is Reviewable

Summary by CodeRabbit

  • New Features

    • JSON view control to switch between parsed data, converted interlinearization, and analyses.
  • Improvements

    • Richer, language-aware interlinear model with runtime enums and standardized camelCase fields.
    • New Paratext 9 parsing and conversion path producing deterministic IDs and text-versioning.
  • Documentation

    • README updated with path-alias import guidance and shared types; spell-check dictionary expanded.
  • Tests

    • Extensive unit and UI tests added for parsing, conversion, view switching, and edge cases.

jasonleenaylor and others added 3 commits January 29, 2026 07:49
…#6)

Add interlinear XML parser, minimal WebView integration, and full test coverage

- Parse PT9 interlinear XML (`fast-xml-parser`) into typed `InterlinearData`
- Public API in `interlinearizer.d.ts` (`StringRange`, `ClusterData`, `VerseData`, etc.)
- Register interlinearizer WebView provider and open React WebView on activation
- Document PT9 schema and parser behavior in `src/parsers/pt9-xml.md`
- Jest unit tests with 100% coverage on parsers, `main`, and web-view
- GitHub Actions workflow for test and lint on push/PR to main
- Handle `Excluded` flag and numeric/hash validation in parser
- Add test-data sample XML and PAPI mocks for tests
@coderabbitai
Copy link

coderabbitai bot commented Feb 19, 2026

Caution

Review failed

An error occurred during the review process. Please try again later.

📝 Walkthrough

Walkthrough

Renames parser to Paratext9Parser, normalizes parsed output to camelCase, adds Paratext‑9 TS types, implements conversion to the Interlinearization model and analysis creation, introduces runtime enums, updates the web view to toggle JSON views, and adjusts tests, docs, and path aliases.

Changes

Cohort / File(s) Summary
Parser core & PT9 types
src/parsers/paratext-9/paratext9Parser.ts, src/parsers/paratext-9/paratext-9-types.ts, src/parsers/paratext-9/pt9-xml.md
Renamed InterlinearXmlParserParatext9Parser; removed ScrTextName; normalized parser output keys to camelCase; added PT9-specific type declarations and updated PT9 XML documentation and examples.
Converter & tests
src/parsers/paratext-9/paratext9Converter.ts, src/__tests__/parsers/paratext-9/paratext9Converter.test.ts
Added conversion from Paratext9 InterlinearData → Interlinearization, deterministic hashing helpers, ID generators, occurrence/assignment creation, and createAnalyses; comprehensive tests for conversion logic and edge cases.
Runtime model & enums
src/types/interlinearizer.d.ts, src/types/interlinearizer-enums.ts
Replaced legacy verse-centric types with hierarchical Interlinearization model and related interfaces; added runtime enums (OccurrenceType, AnalysisType, Confidence, AssignmentStatus).
Web view & tests
src/interlinearizer.web-view.tsx, src/__tests__/interlinearizer.web-view.test.tsx
Switched web view to use Paratext9Parser; added async conversion to Interlinearization and analyses; introduced JsonViewMode with UI to toggle InterlinearData/Interlinearization/Analyses and updated tests/mocks for the new flows.
Config, tooling & docs
tsconfig.json, jest.config.ts, cspell.json, README.md
Added types/* path alias and jest mapping; adjusted coverage exclude pattern; expanded cspell dictionary; README updated to recommend using types/... and parsers/... path aliases and new directory layout.

Sequence Diagram

sequenceDiagram
    participant WebView as Web View (interlinearizer.web-view.tsx)
    participant Parser as Paratext9Parser
    participant Converter as Converter (paratext9Converter)
    participant Display as JSON Display

    WebView->>Parser: parse(xmlString)
    Parser-->>WebView: InterlinearData {glossLanguage, bookId, verses}
    WebView->>Converter: convertParatext9ToInterlinearization(InterlinearData)
    Converter-->>WebView: Interlinearization {books, segments, occurrences}
    WebView->>Converter: createAnalyses(InterlinearData)
    Converter-->>WebView: Map<analysisId, Analysis>
    WebView->>Display: render(selectedView: InterlinearData|Interlinearization|Analyses)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • imnasnainaec

Poem

🐰 A parser renamed, fields hop into place,

glosses and books in a tidy little space.
Converters hum, analyses bloom bright,
JSON views dance under soft web‑view light.
🥕📜

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: introducing the Interlinearization model, refactoring Paratext 9 (PT9) implementation, and adding viewing-mode support for the WebView.
Docstring Coverage ✅ Passed Docstring coverage is 87.50% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch interlinearization-model

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 and usage tips.

coderabbitai[bot]

This comment was marked as resolved.

- Introduce `Interlinearization` data model.
- Move internal-only PT9 types to dedicated file and change case of props.
- Removed `ScrTextName` prop as it's been deprecated in PT9 since 2020.
- Enhance interlinearizer WebView to support switching between viewing modes: InterlinearData and Interlinearization.
- Update Jest configuration to include path aliases for types and parsers.
- Modify README to clarify the structure of the `src/types/` and `src/parsers/` directories.
- Rename `interlinearXmlParser` and related tests to `paratext9parser`.
- Add new words to cspell configuration for improved spell checking.
- Add support for a new JSON view mode displaying analyses derived from parsed data.
- Implement functions to describe and label the new view mode.
- Update the WebView component to include a button for switching to the analyses view.
- Modify tests to cover the new analyses functionality and ensure proper rendering.
- Refactor the `createAnalyses` function to generate analysis maps from interlinear data.
- Change role from 'group' to 'radiogroup' for JSON view mode buttons to improve accessibility.
- Update button roles to 'radio' and aria attributes to 'aria-checked' for better semantic meaning.
- Modify tests to reflect the updated roles and ensure proper functionality of the JSON view mode switch.
@alex-rawlings-yyc alex-rawlings-yyc self-assigned this Feb 19, 2026
coderabbitai[bot]

This comment was marked as resolved.

- Introduce SHA-256 hashing for consistent book-level text version generation across Node and WebView environments.
- Add Web Crypto-based sha256HexWebCrypto for WebView-safe hashing; support injectable hashSha256Hex in converter options for Node (e.g. paranext-core generateHashFromBuffer).
- Compute book text version from sorted, concatenated verse hashes via computeBookTextVersion.
- Update paratext9Converter and tests to align with hash-generation behavior and remove obsolete code.
- Refactor interlinearizer WebView to use useEffect for async conversion and improve JSON view mode buttons.
- Update documentation for data structures and types.
Copy link
Contributor Author

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

Choose a reason for hiding this comment

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

@alex-rawlings-yyc resolved 1 discussion.
Reviewable status: 0 of 14 files reviewed, all discussions resolved (waiting on alex-rawlings-yyc).

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.

3 participants