Skip to content

Add reading_flow: column-aware reading order via XY-cut#386

Merged
JE-Chen merged 1 commit into
devfrom
feat/reading-flow-batch
Jun 23, 2026
Merged

Add reading_flow: column-aware reading order via XY-cut#386
JE-Chen merged 1 commit into
devfrom
feat/reading-flow-batch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 23, 2026

Copy link
Copy Markdown
Member

摘要

新增 flow_order / xy_cut / to_blocks — 以遞迴 XY-cut 還原多欄版面的正確閱讀順序。element_parse.reading_order 是平面上到下 / 左到右排序,在多欄頁面會交錯欄位(讀 A 欄第 1 列、B 欄第 1 列、A 欄第 2 列…)。本功能在最寬留白谷反覆切分(垂直 gutter → 欄、水平 gutter → 列 / 區塊),因此兩欄版面完整讀完 A 欄再讀 B 欄。

公開展平函式命名為 flow_order並列而非遮蔽 element_parse.reading_order,並回傳相同的 index 標記契約(欄位感知的直接升級)。純標準函式庫幾何;重用 table_grid_fill 的框邊界讀取器。Qt-free。

五層

  • 核心:utils/reading_flow/xy_cutflow_orderto_blocks
  • Facade / Executor AC_flow_order + AC_xy_cut / MCP ac_flow_order + ac_xy_cut / Script Builder(OCR)。
  • 文件:v173 EN + Zh + toctree。更新日誌:root EN + zh-TW + zh-CN。

測試

test_reading_flow_batch.py — 兩欄欄位感知順序 A1,A2,B1,B2、頂層 X 切分、單欄上到下、to_blocks 葉數、index 指派、空輸入、wiring + facade。8 passed。ruff / bandit / radon / float-scan / Qt-free 全乾淨。

element_parse.reading_order is a flat top-to-bottom sort that interleaves
columns on multi-column pages (A1, B1, A2, B2). Recover the correct order with
recursive XY-cut: split at the widest whitespace valley (vertical -> columns,
horizontal -> rows), so a two-column page reads A1, A2, B1, B2. flow_order
returns the same index-tagged contract as reading_order (a drop-in column-aware
upgrade, named to not shadow it).
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 53 complexity · 0 duplication

Metric Results
Complexity 53
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@JE-Chen JE-Chen merged commit da680fd into dev Jun 23, 2026
16 checks passed
@JE-Chen JE-Chen deleted the feat/reading-flow-batch branch June 23, 2026 21:43
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant