Table of Contents

Class ParsedDocument

Namespace
LMKit.Document.Parsing
Assembly
LM-Kit.NET.dll

The result of a DocumentParser parse: the parsed pages, in document order, and their renderings in the standard formats.

public sealed class ParsedDocument
Inheritance
ParsedDocument
Inherited Members

Remarks

Each page carries its elements (Elements) with their role, their position and their typed content.

The document renders as Markdown (ToMarkdown(), for LLM and RAG ingestion), semantic HTML (ToHtml(), for display), DocLang (ToDocLang(), the open AI-native document standard) and lossless JSON (ToJson(), which FromJson(string) reads back). Each page renders on its own through the same methods of ParsedPage.

Properties

Elapsed

The wall time the parse took.

Pages

The parsed pages, in document order.

SourceName

The source document's name; empty when it has none.

Methods

FromJson(string)

Reads a document serialized by ToJson(). The document renders as Markdown, HTML and DocLang exactly as the one that was serialized.

SaveDocLang(string)

Writes the document as DocLang markup at path (recommended extension .dclg), as ToDocLang() renders it, with the pictures of the figures written as files in a folder beside it ({name}_files) and referenced by relative URIs instead of embedded.

SaveDocLangArchive(string)

Writes the document as a DocLang archive at path (recommended extension .dclx): the package format the DocLang specification defines, one file holding the markup and the pictures of the figures.

SaveHtml(string)

Writes the document as a standalone HTML page at path, as ToHtml() renders it, with the pictures of the figures written as files in a folder beside it ({name}_files) instead of embedded.

ToDocLang()

Renders the document as DocLang, the open AI-native document markup of the LF AI and Data Foundation (https://www.doclang.ai): headings, text, lists, tables (OTSL cells with their spans), formulas (LaTeX), pictures and charts (with their data as a tabular payload), captions, footnotes and running heads, each with its location, pages separated by page breaks.

ToHtml()

Renders the document as a standalone, semantic HTML page: one section per page, running heads and feet in the page's header and footer, headings levelled, tables with their row and column spans, formulas as LaTeX, and figures and charts as figure elements with their captions and data tables.

ToJson()

Serializes the document as JSON, losslessly: every page with its size and unit, every element with its category, bounds (bbox and polygon), reading index, confidence and typed content, the layout blocks and the figure texts.

ToMarkdown()

Renders the document as Markdown: the pages in order, each element as it reads in the page (headings with their level, tables as HTML, formulas as LaTeX, charts as their data tables), running heads and feet left out.

ToMarkdown(ChartMarkdownStyle)

Renders the document as Markdown as ToMarkdown() does, each chart written as charts says: its data table, the words it prints, or both.

Share