Commit 87b9eeee authored by myhloli's avatar myhloli

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
parent 7c03014c
...@@ -153,7 +153,7 @@ def merge_para_with_text(para_block): ...@@ -153,7 +153,7 @@ def merge_para_with_text(para_block):
elif span_type == ContentType.InlineEquation: elif span_type == ContentType.InlineEquation:
para_text += f" {content} " para_text += f" {content} "
else: else:
if span_type == ContentType.Text: if span_type in [ContentType.Text, ContentType.InlineEquation]:
# 如果是前一行带有-连字符,那么末尾不应该加空格 # 如果是前一行带有-连字符,那么末尾不应该加空格
if __is_hyphen_at_line_end(content): if __is_hyphen_at_line_end(content):
para_text += content[:-1] para_text += content[:-1]
...@@ -161,8 +161,6 @@ def merge_para_with_text(para_block): ...@@ -161,8 +161,6 @@ def merge_para_with_text(para_block):
para_text += f"{content.strip()} " para_text += f"{content.strip()} "
elif span_type == ContentType.InterlineEquation: elif span_type == ContentType.InterlineEquation:
para_text += content para_text += content
elif span_type == ContentType.InlineEquation:
para_text += f"{content} "
else: else:
continue continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment