Skip to content

Nutrient DWS graph body: join wrapped words and CJK lines, tag code fences - #1

Merged
MatusPizur merged 1 commit into
mainfrom
matus/nutrient-dws-graph-joins
Oct 9, 2026
Merged

MatusPizur merged 1 commit into
mainfrom
matus/nutrient-dws-graph-joins

Conversation

@MatusPizur

Copy link
Copy Markdown

The Nutrient DWS graph body keeps the page's visual lines. That breaks text in two ways: a word hyphenated at a line end arrives as two words, and Chinese or Japanese text that wraps gets a space at every line break. This PR joins both in the plain and the styled render, and tags code fences with the language the API reports.

Changes

  • Hyphenated line ends. Regula- + tory becomes Regulatory. A hyphen stays when the next line starts with a capital (Inter- + Provincial), when it belongs to a URL or path, or when it follows a space.
  • CJK line breaks. A break between two Han, kana or full-width characters joins with no space: 健康保险的基 + 本信息 becomes 健康保险的基本信息. Hangul is left alone, because Korean separates words with spaces.
  • Code fences. A Code paragraph opens its fence with the element's codeLanguage (```python) when the response carries one, and a bare fence otherwise.

Testing

tests/parse_bench/inference/providers/parse/test_nutrient_dws_markdown.py: 19 tests pass, 4 of them new (CJK join, Hangul kept, styled CJK heading, code fence language). ruff check and ruff format --check pass on both files.

🤖 Generated with Claude Code

…ences

The graph body keeps the page's visual lines, so a word hyphenated across
a line break arrives as two words, and a Chinese or Japanese sentence that
wraps gets a space at every line break. Both now join: "Regula-" + "tory"
becomes "Regulatory", and "健康保险的基" + "本信息" becomes one line with no
space. Hangul keeps its line breaks as word breaks. URLs keep their own
hyphens, and a hyphen before a capitalised line stays.

Code paragraphs now open their fence with the element's codeLanguage when
the API reports one.
@MatusPizur
MatusPizur requested a review from olihou October 9, 2026 12:27
@MatusPizur
MatusPizur merged commit 336a8a5 into main Oct 9, 2026
4 checks passed
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