Expand description
docparser-core:独立文档解析核心(IR / 统一错误 / 能力抽象 / 注册路由 / 策略 / 引擎)。
与 Python 参考实现(python/docparser/)共享同一 IR 语义与错误码;
是发布形态(见 design_docs 06_release_shape.md)的 Rust 侧核心库。
本 crate 零第三方运行依赖(仅 serde 用于 JSON 往返)。
Re-exports§
pub use engine::DocumentEngine;pub use error::DocError;pub use error::ErrorCode;pub use error::Result;pub use model::Block;pub use model::BlockKind;pub use model::DocMeta;pub use model::Document;pub use model::Image;pub use model::Page;pub use model::Rect;pub use model::TableData;pub use plugin::BackendKind;pub use plugin::FormatPlugin;pub use plugin::ParseCapability;pub use plugin::ProcessCapability;pub use plugin::RawDoc;pub use plugin::RawImage;pub use plugin::RawPage;pub use plugin::RawTextItem;pub use registry::Registry;pub use registry::RegistryError;
Modules§
- emit
- 输出目标:text / markdown(JSON 直接走 serde)。
- engine
- 文档引擎:sniff → 解析链(回退保留原始错误码)→ 处理链(失败仅记录)→ assemble。
- error
- 统一错误分类(与 Python
errors.py/ KB 错误语义对齐)。 - model
- 统一 IR(与 Python
model.py语义一致,含 serde 便于 JSON/CLI 往返)。 - plugin
- 能力抽象(与 Python
capability.py对齐): 解析能力(格式绑定)→ RawDoc;处理能力(全局共享,就地增强)。 - plugins
- 内置插件(纯文本族):txt / md / csv / html。
- policy
- 后端选择策略(与 Python
policy.py对齐)。 - registry
- 注册表:能力 / 后端注册、按策略解析后端链、复合后端委托环检测。
- router
- 路由:按 magic + 扩展名判定格式(与 Python
engine.Router语义对齐)。