doc2txt:
此方法适用在追求速度的doc2txt,会丢失格式化信息,复杂doc可能会出错
使用antiword库,
linux安装antiword库:
apt install antiword
文档转换:
antiword xxx.doc > xxx.txt
速度:363页22w字的doc转换耗时150ms
docx2txt:
库:mammoth
python实现:
import mammoth
text = mammoth.extract_raw_text('xxx.docx').value
137页6w字docx转换耗时2.23s