Byaidu
Byaidu
大概是哪个库的版本对不上吧,重装一下试试
项目结构大概是这样子,可能有点粗糙( - cache.py - 缓存翻译 - translator.py - 提供多种翻译服务 - doclayout.py - 提供 onnx/torch 模型 - converter.py - 解析原页面,拆分成不同的段落并解析公式 - 翻译并缓存段落,调用 translator 和 cache - 排版新页面,将公式插入到翻译后的段落 - 返回页面的新指令流 - high_level.py...
只有 init 提交的部分都和上游一模一样,只有 converter、high_level 和 pdfinterp 是魔改过来的 converter 负责解析和排版,应该可以把 TextConverter 剥离出来 pdfinterp 负责解析指令流,应该也可以剥离 PDFPageInterpreter high_level 这里我们把 TextConverter 和 PDFPageInterpreter 替换成自己的,然后调用上游库应该就行 分离之后项目结构应该能简单很多,我这几天试试
重构完成,现在需要维护/测试的模块只有8个了
unit test https://github.com/Byaidu/PDFMathTranslate/pull/282