Skip to content

Commit

Permalink
Merge pull request #1222 from myhloli/dev
Browse files Browse the repository at this point in the history
fix(dict2md): add space for inline equations in CJK contexts
  • Loading branch information
myhloli authored Dec 7, 2024
2 parents fa113b5 + 74ee428 commit f58a7a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions magic_pdf/dict2md/ocr_mkcontent.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ def merge_para_with_text(para_block):
if content:
langs = ['zh', 'ja', 'ko']
# logger.info(f'block_lang: {block_lang}, content: {content}')
if block_lang in langs: # 中文/日语/韩文语境下,换行不需要空格分隔
if j == len(line['spans']) - 1:
if block_lang in langs: # 中文/日语/韩文语境下,换行不需要空格分隔,但是如果是行内公式结尾,还是要加空格
if j == len(line['spans']) - 1 and span_type not in [ContentType.InlineEquation]:
para_text += content
else:
para_text += f'{content} '
Expand Down

0 comments on commit f58a7a7

Please sign in to comment.