Commit Graph
69 Commits
Author SHA1 Message Date
xugangqiang 1dce167602 chore: remove the DeepDoc Go alignment report (#19311) 2026-09-07 13:11:38 +08:00
xugangqiang 50806c7e95 test(deepdoc): add 1.pdf colspan end-to-end replay test (#19139) 2026-09-02 16:37:50 +08:00
xugangqiang 0d1338d63e fix(deepdoc): harden ORT build guard, OCR test contract (#19082) 2026-09-02 12:13:19 +08:00
xugangqiang c28edde895 feat(deepdoc): in-process static-linked ONNX Runtime DeepDoc backend (#18731) 2026-08-31 13:18:12 +08:00
xugangqiang 9c4c7d0ad4 fix(pdf): remove unused context import breaking manual test build (#18837) 2026-08-27 11:22:07 +08:00
xugangqiang d82ab2eced fix(pdf): do not cross-page merge tables whose anchor is not at page bottom (#18789) 2026-08-27 09:55:59 +08:00
Jin Hai 6c2bca893c Go: fix context, part3 (#18821)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-26 22:33:10 +08:00
Taranum Wasu ee3360bccb fix(pdf): strip tiled watermark text from text-layer extraction (#18308) 2026-08-25 19:52:34 +08:00
jay77721 f9e86b1bb1 fix(parser): crop media sections in PDF JSON path, unify Data URI and markdown rendering (#18742) 2026-08-25 19:47:02 +08:00
xugangqiang b6a0a3cc62 fix(pdf): restore cross-page table merge wrongly rejected by #18688 page-absolute Y gate (#18740) 2026-08-25 19:05:48 +08:00
xugangqiang d7e3592501 fix(pdf): colspan assembly loss + TSR geometry comparison diagnostics (#18727) 2026-08-25 15:03:10 +08:00
Jack 4b6346b052 fix(deepdoc): propagate spanning-cell bbox so Go emits correct colspan (#18707) 2026-08-25 10:41:17 +08:00
Jack 290a8d8f79 fix(deepdoc): prevent cross-page table over-merge from page-local Y coordinates (#18688) 2026-08-25 10:18:01 +08:00
Jack aa6e19e70f fix(deepdoc): resolve OCR text gaps — char loss/duplication in pdf parser (#18643) 2026-08-23 10:22:00 +08:00
Jack b1b8cd6235 fix(deepdoc): align Go table row count with Python per-char R/C in parity replay (#18622) 2026-08-22 23:13:11 +08:00
Jack 6483f84d0c fix(deepdoc): close ocr_real text-gap divergences and pin char-to-box matching (#18630) 2026-08-21 20:12:56 +08:00
Jack 295dc12cc5 fix(deepdoc): preserve covered cells through span injection so span tables keep all TSR rows (#18574) 2026-08-20 19:59:17 +08:00
Jack f793a44f99 fix(deepdoc): dedup OCR substring fragments regardless of whitespace divergence (#18568) 2026-08-20 19:59:05 +08:00
Jack 20ee2dad22 fix(deepdoc): drop nested OCR boxes before table cell fill + expose 13/14 parity gaps (#18524) 2026-08-20 15:57:58 +08:00
Jack c90a0b7a87 feat(deepdoc): Python-intermediate replay parity harness + table cell-fill fixes (#18516) 2026-08-19 21:45:45 +08:00
Wangshu e3def573d4 fix(deepdoc): collapse overlapping OCR boxes before Go table cell-fill (#18507) 2026-08-19 16:05:56 +08:00
Jack 746fe4f0b3 fix(deepdoc): align table header detection with Python (follow-up to #18404) (#18454) 2026-08-19 10:57:30 +08:00
Jack b6b6c4de97 fix(deepdoc): score table orientation by per-line detect+recognize (#18452) 2026-08-18 22:48:39 +08:00
Jack b78b559ac5 Remove noocr/SkipOCR dead code path and text-layer-only parity test (#18443) 2026-08-18 22:47:31 +08:00
Jack c370f629dc fix(deepdoc): align Go table header detection with Python (parity #4) (#18404) 2026-08-18 17:24:19 +08:00
Jack 06463f6a35 fix(deepdoc): preserve cross-page continuation rows on column-count mismatch (#18416) 2026-08-18 16:16:02 +08:00
Jack fb788ee7dc fix(deepdoc): assign each PDF box to a single table cell matching Python (#18410) 2026-08-18 15:13:41 +08:00
Jack fa386ddf10 fix(deepdoc): drop per-cell OCR in Go table parser to align with Python (#18405) 2026-08-18 13:42:16 +08:00
Jack 97db1b4c38 chore(table): remove stale manual parity-issues test (#18403) 2026-08-18 13:18:57 +08:00
Jack 3a7e275155 fix(deepdoc): add orphan-row cleanup to Go table construction (parity with Python) (#18402) 2026-08-18 13:18:25 +08:00
Jack d3ff25763c fix(deepdoc): align table orientation scoring with Python recognition confidence (#18401) 2026-08-18 13:18:09 +08:00
Jack 5ec11f7b07 fix(pdf): align TSR crop margin with Python (fixed 30px, not 3%) (#18387) 2026-08-18 13:11:41 +08:00
Jack f94438adcc fix(parser): check every grid row, not just the first, before cross-page rebuild (#18378) 2026-08-18 09:45:46 +08:00
Jin Hai 68f8260821 Go: fix context, part3 (#18390)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-18 00:07:37 +08:00
Jack cb012380fe fix(deepdoc): trim garbage-gate comments, fix subtest fact error, dedupe constants (#18377) 2026-08-17 19:08:47 +08:00
questfever 52519e2fd7 refactor: replace Split in loops with more efficient SplitSeq (#18248) 2026-08-17 19:04:04 +08:00
Jack 68da250f8f Fix cross-page merged tables dropping continuation rows (#18362) 2026-08-17 17:58:19 +08:00
Jack 7ceafa07f8 fix(deepdoc): drop low-confidence garbage DLA regions to match Python (#18365)
- The Go DLA client (`inference.Client.DLA`) kept `footer`/`header`/`reference` regions whose detection confidence was below 0.4.
- Python's production path (`parse_into_bboxes` -> `LayoutRecognizer.__call__`, `deepdoc/vision/layout_recognizer.py:97` and `:379`) drops such regions via a 0.4 garbage gate over
`garbage_layouts=['footer','header','reference']`.
- The shared `/predict/dla` backend runs `LayoutRecognizer.forward`, which does **not** apply that gate, so the Go client was the only place the filter was missing — a real Go<->Python parity gap.
2026-08-17 17:50:28 +08:00
Jack bd01c78d2b fix(pdf): drop text boxes only when replaced by a table HTML (#18363)
## Problem
In the Go PDF pipeline, `processTablesWithReplacements`
(`internal/deepdoc/parser/pdf/table/table_post.go`) marked **every** box
overlapping a DLA table region for removal, then `insertTableBoxes`
re-inserted an HTML box only when `buildTableHTMLs` produced one.

When DLA over-labels a **text** box as a table but TSR produces **no
cells** (so `buildTableHTMLs` skips the table and `htmls[ti]` is unset),
the box was removed with nothing re-inserted — the original text was
**silently dropped**.
2026-08-17 17:07:56 +08:00
Jack 8d20cbd0b3 deepdoc(pdf): WarpCrop de-skew + score-based layer-2 rotation (Go OCR parity with Python) (#18299)
Supersedes / folds in #18305. The score-based layer-2 rotation selection from #18305 now lives here, on top of `WarpCrop` (layer 1), applied to **all three** Go OCR paths, together with the Python score plumbing the Go side depends on. #18305 is closed in favor of this PR.
2026-08-17 15:13:56 +08:00
Jack 272645a27a fix(pdf): align DLA region handling with Python reference (#18295)
Aligns three Go DLA / PDF post-processing behaviors with the Python `deepdoc` reference so the Go PDF pipeline matches Python's DLA region / annotation semantics.
2026-08-17 14:33:44 +08:00
Jin Hai fa5762336b Go: fix context, part2 (#18296)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-14 19:42:41 +08:00
Jack 2678a0c5f5 deepdoc: send lossless PNG instead of JPEG to the DeepDoc inference service (#18282) 2026-08-14 18:49:33 +08:00
Jack 7646afab1b fix(pdf/layout): recover title-bridged & gutter-less double columns (2D rescue + L3) (#18150)
Incremental follow-up to #18023 (gap + balance-gate hybrid). Adds two
complementary column detectors to `AssignColumn` that run **only after**
the gap detector and the balance gate both fail, so already-correct
pages are never touched.
2026-08-12 17:59:50 +08:00
Jack b4dd0f7a0c fix(pdf/layout): replace KMeans-only column detection with gap + KMeans hybrid (#18023) 2026-08-11 22:13:42 +08:00
Jin Hai d7661b676d Go: fix context and warnings (#18097)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-11 16:18:49 +08:00
Jin Hai 86021932ae Go: fix warnings (#17738)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-03 21:30:01 +08:00
Jin Hai 266837eb33 Go: add context to redis client (#17689)
Signed-off-by: Jin Hai <haijin.chn@gmail.com>
2026-08-02 22:50:54 +08:00
futurehua bd355deaa9 refactor: use the built-in max/min to simplify the code (#17059)
### Summary

In Go 1.21, the standard library includes built-in
[max/min](https://pkg.go.dev/builtin@go1.21.0#max) function, which can
greatly simplify the code.

Signed-off-by: futurehua <futurehua@outlook.com>
2026-07-24 15:33:02 +08:00
Jack d12fd3b79d feat: parser pages range and parse type validation for dataset/document (#17293)
## Summary

Adds page-range parsing support to the Go-native pipeline path and
introduces strict `parse_type` validation for both dataset and document
update endpoints.

## What changed

### Pages range parsing
- **`internal/utility/pdf_pages.go`** — `NormalizePDFPages`: normalizes
raw page ranges (list of `[from,to]` 1-indexed inclusive ranges) into
sorted, merged, deduplicated `[][]int`. Invalid ranges are dropped.
- **`internal/ingestion/pipeline/pdf_pages.go`** —
`NormalizeParserConfigPages`: walks any parser_config map and normalizes
`"pages"` values under every component → filetype setup, so the
persisted config always carries clean, merged ranges.
- **`internal/deepdoc/parser/pdf/parser.go`** — integrates
`resolvePagesToProcess` to filter parsed PDF pages by the configured
ranges.
- Pipeline integration (parser pages):
`internal/parser/parser/pdf_parser_common.go`, `chunk_process.go`, plus
associated e2e and unit tests.

### Parse type validation (shared logic)
- **`internal/service/parser_mode.go`** (new) — `ValidateParseTypeMode`:
shared function that validates `parse_type` (1=BuiltIn/parser_id,
2=Pipeline/pipeline_id) and ensures the corresponding field is present.
Used by both dataset and document update endpoints.
- **`internal/service/dataset/crud.go`** / `update.go` — replaces inline
`isPipelineMode`/`isBuiltinMode` computation with the shared
`service.ValidateParseTypeMode`.
- **`internal/service/document/document_dataset_update.go`** — adds
strict `parse_type` validation in `validateDatasetDocumentUpdate`,
simplifies the reparse logic to a two-way switch (isBuiltin/isPipeline)
now that parse_type is always valid.
- **`internal/service/document/document.go`** — adds `ParseType` field
to `UpdateDatasetDocumentRequest`.
- **`internal/service/document/document_dataset_update.go`** —
`updateDocumentParserConfig` fallback path when DSL loading fails.
- **`internal/service/parser_mode_test.go`** (new) — test coverage for
nil, invalid, and missing-field scenarios.

### Frontend
- **`web/src/interfaces/request/document.ts`** — adds `parseType` to
`IChangeParserRequestBody`.
- **`web/src/hooks/use-document-request.ts`** —
`useSetDocumentPipelineParser` sends `parse_type` in the PATCH payload.
- **`web/src/pages/dataset/dataset/use-change-document-parser.ts`** —
Go/Python branching for the document parser config dialog.
-
**`web/src/components/document-pipeline-dialog/use-document-pipeline-form.ts`**
— `buildSubmitData` returns `parseType` (bugfix: was dropped from the
return value).

### Test changes
- **Removed**: 2 tests that verified the old "mutually exclusive" error
(replaced by `ValidateParseTypeMode` coverage).
- **Modified**: 6 tests across document and dataset packages to include
`ParseType` in request structs.
- **Added**: new e2e tests for pages parsing (`pages_e2e_test.go`,
`pdf_parser_pages_e2e_test.go`) and unit tests for `NormalizePDFPages`,
`NormalizeParserConfigPages`, `resolvePagesToProcess`.

## Backward compatibility
- The `parse_type` field is **required** when `parser_id` or
`pipeline_id` is sent. This changes the contract for both dataset and
document PATCH endpoints, but aligns the Go backend with the existing
frontend behavior (the frontend already sends `parse_type`). Callers
that omit `parse_type` when updating parser/pipeline selections will
receive a clear error message.
- Existing callers that only update fields like `name`, `enabled`, or
`meta_fields` are unaffected.
- Test updates ensure all known call sites are compliant.
2026-07-23 19:57:27 +08:00