Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix pdf reader #107

Merged
merged 2 commits into from
Jul 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/pai_rag/integrations/readers/pai_pdf_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,10 @@ def merge_page_tables(total_tables: List[PageItem]) -> List[PageItem]:
table = total_tables[i]
pre_table = total_tables[i - 1]
if table["page_number"] == pre_table["page_number"]:
i -= 1
continue
if table["page_number"] - pre_table["page_number"] > 1:
i -= 1
continue
if (
table["index_id"] <= 1
Expand Down Expand Up @@ -196,7 +198,11 @@ def table_to_json(table: List[List]) -> str:
for row in range(1, len(table)):
single_line_dict = {}
for column in range(len(column_name)):
if column_name[column] and len(column_name[column]) > 0:
if (
column_name[column]
and len(column_name[column]) > 0
and column < len(table[row])
):
single_line_dict[column_name[column]] = table[row][column]
table_info.append(single_line_dict)

Expand Down
Loading