fix(ocr): handle inline equations consistently with text content

- Include InlineEquation in the condition for handling text content
- Remove separate block for InlineEquation processing
- Ensures consistent handling of inline equations and text, improving content formatting
This commit is contained in:
myhloli
2024-11-01 23:35:36 +08:00
parent 7c03014c2a
commit 87b9eeee59
+1 -3
View File
@@ -153,7 +153,7 @@ def merge_para_with_text(para_block):
elif span_type == ContentType.InlineEquation:
para_text += f" {content} "
else:
if span_type == ContentType.Text:
if span_type in [ContentType.Text, ContentType.InlineEquation]:
# 如果是前一行带有-连字符,那么末尾不应该加空格
if __is_hyphen_at_line_end(content):
para_text += content[:-1]
@@ -161,8 +161,6 @@ def merge_para_with_text(para_block):
para_text += f"{content.strip()} "
elif span_type == ContentType.InterlineEquation:
para_text += content
elif span_type == ContentType.InlineEquation:
para_text += f"{content} "
else:
continue