madog1983
madog1983
**问题描述 / Problem Description** 在向知识库中添加老版本word的.doc文件(非.docx)时,提示以下错误: ` 2024-03-25 09:45:44,663 - utils.py[line:377] - ERROR: PackageNotFoundError: 从文件 samples/test.doc 加载文档时出错:Package not found at 'G:\langchain-chatchat\Langchain-Chatchat\knowledge_base\samples\content\test.doc' ` 经过调试,发现问题出在项目中/document_loader/mydocloader.py中的RapidOCRDocLoader类中,_get_elements方法内的doc2text方法。其中用于**解析word文档所使用的库是docx库,该库只支持.docx格式,不支持老的.doc格式**。该库在解析文件时会检查文件是否为zip格式,然而老版本的.doc文件非zip格式,会抛出PackageNotFoundError。 **环境信息 / Environment Information** - langchain-ChatGLM 版本/commit 号:0.0.354...
**功能描述 / Feature Description** 增加识别非OpenXML格式的Word文件(.doc)的功能。 **解决的问题 / Problem Solved** 目前对于word文档的内容识别是使用RapidOCRDocLoader类完成的。然而目前RapidOCRDocLoader类的实现中使用**docx**库来对文件进行识别,该库只能识别OpenXML格式,也就是.docx格式的文件,对于.doc格式的文件无法进行识别并报错: ``` 2024-05-07 22:40:28,179 - utils.py[line:377] - ERROR: ValueError: 从文件 test/test.doc 加载文档时出错:file 'G:\langchain-chatchat\Langchain-Chatchat\knowledge_base\test\content\test.doc' is not a Word file, content type is...