fasdfsa commited on
Commit
4e31cfc
·
1 Parent(s): 5e5821a
data/ch01/out2/page_texts.json CHANGED
Binary files a/data/ch01/out2/page_texts.json and b/data/ch01/out2/page_texts.json differ
 
ocr/gendatav2.py CHANGED
@@ -47,7 +47,7 @@ for raw_json in raw_jsons:
47
  currPageId = -1
48
  lastPageId = -1
49
  currPageText = ""
50
- # for js in paragraphs:
51
  for i, js in enumerate(paragraphs):
52
  startPageId = js["startPageId"]
53
  endPageId = js["endPageId"]
@@ -78,9 +78,10 @@ for i, js in enumerate(paragraphs):
78
 
79
  if i == len(paragraphs) - 1:
80
  if currPageText: # 最后一个段落,保存上一页文本
81
- text_pages[currPageId] = currPageText
82
- currPageText = ""
83
- currPageId = PageId
 
84
  else:
85
  currPageText += " "
86
  texts += " "
 
47
  currPageId = -1
48
  lastPageId = -1
49
  currPageText = ""
50
+
51
  for i, js in enumerate(paragraphs):
52
  startPageId = js["startPageId"]
53
  endPageId = js["endPageId"]
 
78
 
79
  if i == len(paragraphs) - 1:
80
  if currPageText: # 最后一个段落,保存上一页文本
81
+ if currPageId not in text_pages:
82
+ text_pages[currPageId] = currPageText
83
+ currPageText = ""
84
+ currPageId = PageId
85
  else:
86
  currPageText += " "
87
  texts += " "