fix ch01
Browse files- data/ch01/out2/page_texts.json +0 -0
- ocr/gendatav2.py +5 -4
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 |
-
|
| 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 |
-
|
| 82 |
-
|
| 83 |
-
|
|
|
|
| 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 += " "
|