1
0

整合代码

This commit is contained in:
2026-02-15 20:25:28 +08:00
parent f30ea08805
commit f167aa2111
5 changed files with 28 additions and 96 deletions

View File

@@ -5,21 +5,12 @@ import xml.etree.ElementTree as ET
import zipfile
from typing import List, Optional, Tuple
from common import parse_with_markitdown
def parse_xlsx_with_markitdown(file_path: str) -> Tuple[Optional[str], Optional[str]]:
"""使用 MarkItDown 库解析 XLSX 文件"""
try:
from markitdown import MarkItDown
md = MarkItDown()
result = md.convert(file_path)
if not result.text_content.strip():
return None, "文档为空"
return result.text_content, None
except ImportError:
return None, "MarkItDown 库未安装"
except Exception as e:
return None, f"MarkItDown 解析失败: {str(e)}"
return parse_with_markitdown(file_path)
def parse_xlsx_with_pandas(file_path: str) -> Tuple[Optional[str], Optional[str]]: