refactor(load,tract):将 ModelMetadata JSON 加载逻辑解耦至 ddddocr-tract, 优化 Error 枚举结构与错误透传

- 在 load 模块中精简 Error 与 Result 别名定义
- 增加 ParseError 子类型区分路径与字节流加载失败
- 支持通过 #[from] 自动转换 Tract 引擎底层错误
- 移出 core 中的 serde 依赖,保持核心库纯洁
- 在 tract 中实现 TractModelMetadata 扩展 trait 加载解析配置
This commit is contained in:
2026-07-23 13:43:32 +08:00
parent 3499e89bf1
commit 44dae08221
24 changed files with 614 additions and 530 deletions

View File

@@ -2,8 +2,8 @@ use std::borrow::Cow;
use std::fs::File;
use std::path::Path;
use anyhow::anyhow;
use ddddocr_core::ocr::metadata::Charset;
use ddddocr_core::ocr::metadata::{Normalization, Resize};
use ddddocr_core::ocr::Charset;
use ddddocr_core::ocr::{Normalization, Resize};
pub const CHARSET_BETA: &[&str] = &[
"", "", "", "", "", "", "", "", "", "", "", "", "", "6", "", "",