JATS: content of `<sub-article>` is not converted

クローズ
#4,792 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #4826 @LubabaKhalid による — マージ済み

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

Start with docling/backend/xml/jats_backend.py around JatsDocumentBackend.convert() at lines 292–299, where the issue says only the first //body and //back are walked. Use the provided minimal JATS input to reproduce the missing ALPHA-SUB text and inspect the existing XML backend tests for a place to add a fixture. Done means the sub-article text appears in the converted document and the test covers the main article text as well.

索引モデルが issue の本文から書いたものです。

説明

Bug

A follow-up to #3583, split out as one narrow case.

JatsDocumentBackend.convert() walks only the first //body and the first //back (jats_backend.py#L292-L299 at v2.138.0). A <sub-article>'s own body is never reached, so none of its text reaches the document.

Publishers use <sub-article> for published peer-review records, author responses, translated abstracts and decision letters. In two PLOS Computational Biology articles we checked, the review record holds 127 and 109 paragraphs longer than 60 characters, and none of them is in the conversion.

Minimal input (after the prologue):

<front><article-meta><title-group><article-title>Control</article-title></title-group></article-meta></front>
<body><sec><title>S</title><p>ALPHA-MAIN paragraph.</p></sec></body>
<sub-article article-type="author-comment" id="sub1"><body><p>ALPHA-SUB reviewer paragraph.</p></body></sub-article>
</article>

Observed on v2.138.0 (a76ae4b6) and on main (f0d90989), unchanged since 2.131.0: ALPHA-MAIN is in the document; ALPHA-SUB is not, anywhere in export_to_dict().

Is skipping <sub-article> intended? If not, how would you like it represented: for example, as a separate section, or in a different content layer? We're happy to contribute the fixture and a test.

Steps to reproduce

Save the article as article.xml, then:

from docling.document_converter import DocumentConverter
doc = DocumentConverter().convert("article.xml").document
print(doc.export_to_markdown())
print([(t.text, t.hyperlink) for t in doc.texts])

Every article starts with this prologue. The backend needs a DOCTYPE.

<?xml version="1.0"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Publishing DTD v1.3 20210610//EN" "JATS-journalpublishing1-3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" article-type="research-article">
Docling version

v2.138.0 (a76ae4b6) and main (f0d90989), each installed as docling-slim[standard] from git.

Python version

3.14.7

主要言語
Python
スター
70.1k
フォーク
5.3k
平均マージ
3日 4時間
マージ済み PR(30日)
212

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

docling-project/docling のほかの issue

docling-project/docling の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。