Skip to content

Commit

Permalink
Updated Tesseract.js to fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica committed Dec 28, 2024
1 parent 6f28688 commit 267bef0
Show file tree
Hide file tree
Showing 18 changed files with 1,431 additions and 1,405 deletions.
24 changes: 10 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"dependencies": {
"canvaskit-wasm": "^0.39.1",
"commander": "^11.1.0",
"@scribe.js/tesseract.js": "^5.1.6"
"@scribe.js/tesseract.js": "^6.0.2"
}
}
349 changes: 175 additions & 174 deletions tess/core/tesseract-core-lstm.wasm.js

Large diffs are not rendered by default.

349 changes: 175 additions & 174 deletions tess/core/tesseract-core-simd-lstm.wasm.js

Large diffs are not rendered by default.

345 changes: 173 additions & 172 deletions tess/core/tesseract-core-simd.wasm.js

Large diffs are not rendered by default.

345 changes: 173 additions & 172 deletions tess/core/tesseract-core.wasm.js

Large diffs are not rendered by default.

349 changes: 175 additions & 174 deletions tess/core_vanilla/tesseract-core-lstm.wasm.js

Large diffs are not rendered by default.

349 changes: 175 additions & 174 deletions tess/core_vanilla/tesseract-core-simd-lstm.wasm.js

Large diffs are not rendered by default.

345 changes: 173 additions & 172 deletions tess/core_vanilla/tesseract-core-simd.wasm.js

Large diffs are not rendered by default.

345 changes: 173 additions & 172 deletions tess/core_vanilla/tesseract-core.wasm.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/tesseract.esm.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/tesseract.esm.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/tesseract.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/tesseract.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/worker.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tess/worker.min.js.map

Large diffs are not rendered by default.

Binary file added tests/assets/italics_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions tests/module/recognize.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ describe('Check basic recognition features.', function () {
}).timeout(10000);
});

describe('Check style detection.', function () {
this.timeout(20000);
before(async () => {
// This article page contains mostly italic text.
await scribe.importFiles([`${ASSETS_PATH_KARMA}/italics_1.png`]);
await scribe.recognize({
modeAdv: 'legacy',
});
});

it('Italic words are identified correctly', async () => {
assert.strictEqual(scribe.data.ocr.active[0].lines[0].words[3].style, 'normal');
assert.strictEqual(scribe.data.ocr.active[0].lines[0].words[4].style, 'italic');
assert.strictEqual(scribe.data.ocr.active[0].lines[0].words[5].style, 'italic');
assert.strictEqual(scribe.data.ocr.active[0].lines[0].words[6].style, 'normal');
}).timeout(10000);

after(async () => {
await scribe.terminate();
});
});

describe('Check font optimization features.', function () {
this.timeout(20000);
before(async () => {
Expand Down

0 comments on commit 267bef0

Please sign in to comment.