Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
Fix otsl to html conversion
Carkham0031981e60bb
diff --git a/mineru/utils/format_utils.py b/mineru/utils/format_utils.pyindex 3cf6ec08..7462f649 100644--- a/mineru/utils/format_utils.py+++ b/mineru/utils/format_utils.py@@ -132,6 +132,35 @@ def otsl_parse_texts(texts, tokens):r_idx = 0c_idx = 0+ # Check and complete the matrix+ if split_row_tokens:+ max_cols = max(len(row) for row in split_row_tokens)++ # Insert additional <ecel> to tags+ for row_idx, row in enumerate(split_row_tokens):+ while len(row) < max_cols:+ row.append(OTSL_ECEL)++ # Insert additional <ecel> to texts+ new_texts = []+ text_idx = 0++ for row_idx, row in enumerate(split_row_tokens):+ for col_idx, token in enumerate(row):+ new_texts.append(token)+ if text_idx < len(texts) and texts[text_idx] == token:+ text_idx += 1+ if (text_idx < len(texts) and+ texts[text_idx] not in [OTSL_NL, OTSL_FCEL, OTSL_ECEL, OTSL_LCEL, OTSL_UCEL, OTSL_XCEL]):+ new_texts.append(texts[text_idx])+ text_idx += 1++ new_texts.append(OTSL_NL)+ if text_idx < len(texts) and texts[text_idx] == OTSL_NL:+ text_idx += 1++ texts = new_texts+def count_right(tokens, c_idx, r_idx, which_tokens):span = 0c_idx_iter = c_idx@@ -235,10 +264,11 @@ def export_to_html(table_data: TableData):body = ""+ grid = table_data.gridfor i in range(nrows):body += "<tr>"for j in range(ncols):- cell: TableCell = table_data.grid[i][j]+ cell: TableCell = grid[i][j]rowspan, rowstart = (cell.row_span,