cd2068d7 by 周伟奇

fix last pno

1 parent 7453129c
...@@ -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
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!