和顺 / 共识 返回所属 Agent
GS-03.01

原文与事实登记

原能力

把事实主张关联到材料版本、出处和原文位置,区分待核材料与已确认事实。(细化版 p.14–15)

首选项目

Docling(MIT 代码,模型许可独立)。 Docling

匹配范围

版面块/表格抽取与文本片段标注保留位置。

源码

Docling · def convert(

docling/document_converter.py · 696–709 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
    def convert(
        self,
        source: Union[Path, str, DocumentStream, HttpSource],  # TODO review naming
        headers: Optional[dict[str, str]] = None,
        raises_on_error: bool = True,
        max_num_pages: int = sys.maxsize,
        max_file_size: int = sys.maxsize,
        page_range: PageRange = DEFAULT_PAGE_RANGE,
        progress_callback: Optional[ProgressCallback] = None,
    ) -> ConversionResult:
        """Convert one document fetched from a file path, URL, or DocumentStream.

        A generic ZIP archive can contain multiple documents. Use ``convert_all``
        for such archives. This method raises ``ConversionError`` instead of
  • # SPDX-License-Identifier: MIT

Taguette · class Highlight

taguette/database/models.py · 592–605 行。 在 GitHub 查看源码 · 许可证与声明

源码片段
class Highlight(Base):
    __tablename__ = 'highlights'
    __table_args__ = ({'sqlite_autoincrement': True},)

    id = Column(Integer, primary_key=True)
    document_id = Column(Integer, ForeignKey('documents.id',
                                             ondelete='CASCADE'),
                         nullable=False, index=True)
    document = relationship('Document', back_populates='highlights')
    start_offset = Column(Integer, nullable=False)
    end_offset = Column(Integer, nullable=False)
    snippet = Column(Text, nullable=False)
    tags = relationship('Tag', secondary='highlight_tags',
                        back_populates='highlights')
接口用法示意
document = DocumentConverter().convert(source).document

实现与验收要点

事实主张和材料版本快照、可见范围及核实状态。