Add printed page number metadata to SDK JSON output#171
Open
VooDisss wants to merge 2 commits intozai-org:mainfrom
Open
Add printed page number metadata to SDK JSON output#171VooDisss wants to merge 2 commits intozai-org:mainfrom
VooDisss wants to merge 2 commits intozai-org:mainfrom
Conversation
Route PP-DocLayoutV3 'number' regions through OCR instead of dropping them, then extract printed page number evidence from recognized number blocks in the result formatter. Preserve the feature as number-only, support both numeric and Roman labels, and derive three explicit output layers: page_number_candidates, document_page_numbering, and page_metadata. Keep the general json_result contract lean by stripping transient layout_index and layout_score fields from final blocks while retaining native_label, and wrap saved paper.json only when real printed-page data exists. Also expose detect_printed_page_numbers through config, constructor, and environment overrides, align MaaS output with self-hosted behavior, add contract-focused tests for legacy-vs-wrapped save behavior and lean json_result output, and document the exact save contract in the English and Chinese READMEs.
Contributor
Author
|
@JaredforReal please check it out |
This was referenced Mar 31, 2026
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.
Fixes: #170 and #168 (was just planning)
Summary
numberregions through OCR instead of dropping themnumberblocks and exposepage_number_candidates,document_page_numbering, andpage_metadatajson_resultblocks lean and wrap savedpaper.jsononly when real printed-page data existsDetails
native_label == "number"onlypaper.jsonwhen the feature is disabled or when no printed-page candidates are foundValidation
paper.jsonpaper.jsonpaper.jsonjson_resultoutput without broadlayout_index/layout_scoreleakagenative_label: "number"blocks survive into finaljson_resultpage_metadata