Skip to content

Commit 241cddb

Browse files
authored
Disabled non-text output formats by default per #916 (#983)
1 parent e2e8e3b commit 241cddb

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

benchmarks/node/memory-benchmark.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const workerGen = async () => {
5050
const promises = [];
5151
for (let j = 0; j < 10; j++) {
5252
// Results are purposefully not saved as this would increase memory usage over time.
53-
promises.push(scheduler.addJob('recognize', file).then(() => (true)));
53+
promises.push(scheduler.addJob('recognize', file, {}, { blocks: true }).then(() => (true)));
5454
}
5555
// eslint-disable-next-line no-await-in-loop
5656
await Promise.all(promises);

docs/api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ Figures out what words are in `image`, where the words are in `image`, etc.
8282
- `image` see [Image Format](./image-format.md) for more details.
8383
- `options` an object of customized options
8484
- `rectangle` an object to specify the regions you want to recognized in the image, should contain top, left, width and height, see example below.
85-
- `output` an object specifying which output formats to return (by default `text`, `blocks`, `hocr`, and `tsv` are returned)
85+
- `output` an object specifying which output formats to return (by default only `text` is returned)
86+
- Other options include `blocks` (json), `hocr`, and `tsv`
8687
- `jobId` Please see details above
8788

8889
**Output:**

src/createWorker.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ module.exports = async (langs = 'eng', oem = OEM.LSTM_ONLY, _options = {}, confi
165165
);
166166

167167
const recognize = async (image, opts = {}, output = {
168-
blocks: true, text: true, hocr: true, tsv: true,
168+
text: true,
169169
}, jobId) => (
170170
startJob(createJob({
171171
id: jobId,

src/worker-script/constants/defaultOutput.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
module.exports = {
66
text: true,
7-
blocks: true,
7+
blocks: false,
88
layoutBlocks: false,
9-
hocr: true,
10-
tsv: true,
9+
hocr: false,
10+
tsv: false,
1111
box: false,
1212
unlv: false,
1313
osd: false,

0 commit comments

Comments
 (0)