Skip to content

Commit 53c7231

Browse files
committed
Raised number of possible layout boxes
1 parent 86ca45f commit 53c7231

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

js/modifyOCR.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,9 @@ export function reorderOcrPage(page, layoutObj, applyExclude = true, editInPlace
202202

203203
const orderArr = Array(hocrALines.length);
204204

205-
// 10 assumed to be lowest priority for text included in the output and is assigned to any word that does not overlap with a "order" layout box
206-
orderArr.fill(10);
205+
// All assigned priorities are assumed to be 0-99.
206+
// 100 should be lower priority than every assigned value.
207+
orderArr.fill(100);
207208

208209
for (let i = 0; i < hocrALines.length; i++) {
209210
const hocrALine = hocrALines[i];
@@ -215,14 +216,14 @@ export function reorderOcrPage(page, layoutObj, applyExclude = true, editInPlace
215216
if (obj.type === 'order') {
216217
orderArr[i] = obj.order;
217218
} else if (obj.type === 'exclude' && applyExclude) {
218-
// Priority "11" is used to remove lines
219-
orderArr[i] = 11;
219+
// Priority "101" is used to remove lines
220+
orderArr[i] = 101;
220221
}
221222
}
222223
}
223224
}
224225

225-
for (let i = 0; i <= 10; i++) {
226+
for (let i = 0; i <= 100; i++) {
226227
for (let j = 0; j < orderArr.length; j++) {
227228
if (orderArr[j] === i) {
228229
linesNew.push(hocrALines[j]);

0 commit comments

Comments
 (0)