Skip to content

Commit fb6394f

Browse files
authored
Fixed layoutBlocks format and added new test per #985 (#986)
1 parent 28846b3 commit fb6394f

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"node-fetch": "^2.6.9",
6969
"opencollective-postinstall": "^2.0.3",
7070
"regenerator-runtime": "^0.13.3",
71-
"tesseract.js-core": "^6.0.0-0",
71+
"tesseract.js-core": "^6.0.0-1",
7272
"wasm-feature-detect": "^1.2.11",
7373
"zlibjs": "^0.3.1"
7474
},

tests/recognize.test.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,4 +294,15 @@ describe('recognize()', () => {
294294
expect(blocks[0].paragraphs[0].lines[0].text).to.be('繁體 中 文 測試\n');
295295
}).timeout(TIMEOUT);
296296
});
297+
298+
describe('should support layout blocks (json) output', () => {
299+
it('recongize large image', async () => {
300+
await worker.reinitialize('eng');
301+
const { data: { layoutBlocks } } = await worker.recognize(`${IMAGE_PATH}/testocr.png`, {}, { text: false, layoutBlocks: true });
302+
expect(layoutBlocks[0].bbox[0]).to.be(36);
303+
expect(layoutBlocks[0].bbox[1]).to.be(92);
304+
expect(layoutBlocks[0].bbox[2]).to.be(618);
305+
expect(layoutBlocks[0].bbox[3]).to.be(361);
306+
}).timeout(TIMEOUT);
307+
});
297308
});

0 commit comments

Comments
 (0)