fix last pno
Showing
1 changed file
with
4 additions
and
1 deletions
| ... | @@ -195,7 +195,9 @@ class Retriever: | ... | @@ -195,7 +195,9 @@ class Retriever: |
| 195 | pdf_result = dict() | 195 | pdf_result = dict() |
| 196 | 196 | ||
| 197 | for pno_str, fields_dict in self.target_fields.items(): | 197 | for pno_str, fields_dict in self.target_fields.items(): |
| 198 | is_last_pno = False | ||
| 198 | if pno_str == '-1': | 199 | if pno_str == '-1': |
| 200 | is_last_pno = True | ||
| 199 | pno_int_list = [int(pno_str) for pno_str in pdf_text_list.keys()] | 201 | pno_int_list = [int(pno_str) for pno_str in pdf_text_list.keys()] |
| 200 | pno_str = str(max(pno_int_list)) | 202 | pno_str = str(max(pno_int_list)) |
| 201 | 203 | ||
| ... | @@ -248,6 +250,7 @@ class Retriever: | ... | @@ -248,6 +250,7 @@ class Retriever: |
| 248 | self.position_str: list(coordinates), | 250 | self.position_str: list(coordinates), |
| 249 | } | 251 | } |
| 250 | 252 | ||
| 251 | pdf_result['page_{0}'.format(int(pno_str) + 1)] = page_result | 253 | page_key = 'page_12' if is_last_pno else 'page_{0}'.format(int(pno_str) + 1) |
| 254 | pdf_result[page_key] = page_result | ||
| 252 | 255 | ||
| 253 | return pdf_result | 256 | return pdf_result | ... | ... |
-
Please register or sign in to post a comment