Skip to content

Commit

Permalink
Updated output and types per #990 (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
Balearica authored Jan 7, 2025
1 parent 901d881 commit 56d8238
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 105 deletions.
7 changes: 1 addition & 6 deletions src/createWorker.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const resolvePaths = require('./utils/resolvePaths');
const circularize = require('./utils/circularize');
const createJob = require('./createJob');
const { log } = require('./utils/log');
const getId = require('./utils/getId');
Expand Down Expand Up @@ -204,11 +203,7 @@ module.exports = async (langs = 'eng', oem = OEM.LSTM_ONLY, _options = {}, confi
const promiseId = `${action}-${jobId}`;
if (status === 'resolve') {
log(`[${workerId}]: Complete ${jobId}`);
let d = data;
if (action === 'recognize') {
d = circularize(data);
}
promises[promiseId].resolve({ jobId, data: d });
promises[promiseId].resolve({ jobId, data });
delete promises[promiseId];
} else if (status === 'reject') {
promises[promiseId].reject(data);
Expand Down
43 changes: 0 additions & 43 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,9 @@ declare namespace Tesseract {
paragraphs: Paragraph[];
text: string;
confidence: number;
baseline: Baseline;
bbox: Bbox;
blocktype: string;
polygon: any;
page: Page;
lines: Line[];
words: Word[];
symbols: Symbol[];
}
interface Baseline {
x0: number;
Expand All @@ -186,38 +181,21 @@ declare namespace Tesseract {
baseline: Baseline;
rowAttributes: RowAttributes
bbox: Bbox;
paragraph: Paragraph;
block: Block;
page: Page;
symbols: Symbol[];
}
interface Paragraph {
lines: Line[];
text: string;
confidence: number;
baseline: Baseline;
bbox: Bbox;
is_ltr: boolean;
block: Block;
page: Page;
words: Word[];
symbols: Symbol[];
}
interface Symbol {
choices: Choice[];
image: any;
text: string;
confidence: number;
baseline: Baseline;
bbox: Bbox;
is_superscript: boolean;
is_subscript: boolean;
is_dropcap: boolean;
word: Word;
line: Line;
paragraph: Paragraph;
block: Block;
page: Page;
}
interface Choice {
text: string;
Expand All @@ -228,38 +206,17 @@ declare namespace Tesseract {
choices: Choice[];
text: string;
confidence: number;
baseline: Baseline;
bbox: Bbox;
is_numeric: boolean;
in_dictionary: boolean;
direction: string;
language: string;
is_bold: boolean;
is_italic: boolean;
is_underlined: boolean;
is_monospace: boolean;
is_serif: boolean;
is_smallcaps: boolean;
font_size: number;
font_id: number;
font_name: string;
line: Line;
paragraph: Paragraph;
block: Block;
page: Page;
}
interface Page {
blocks: Block[] | null;
confidence: number;
lines: Line[];
oem: string;
osd: string;
paragraphs: Paragraph[];
psm: string;
symbols: Symbol[];
text: string;
version: string;
words: Word[];
hocr: string | null;
tsv: string | null;
box: string | null;
Expand Down
56 changes: 0 additions & 56 deletions src/utils/circularize.js

This file was deleted.

0 comments on commit 56d8238

Please sign in to comment.