File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -41,15 +41,15 @@ declare namespace Tesseract {
41
41
load_number_dawg : string
42
42
load_bigram_dawg : string
43
43
}
44
-
44
+
45
45
type LoggerMessage = {
46
46
jobId : string
47
47
progress : number
48
48
status : string
49
49
userJobId : string
50
50
workerId : string
51
51
}
52
-
52
+
53
53
interface WorkerOptions {
54
54
corePath : string
55
55
langPath : string
@@ -166,7 +166,7 @@ declare namespace Tesseract {
166
166
interface RowAttributes {
167
167
ascenders : number ;
168
168
descenders : number ;
169
- row_height : number ;
169
+ rowHeight : number ;
170
170
}
171
171
interface Bbox {
172
172
x0 : number ;
Original file line number Diff line number Diff line change @@ -318,6 +318,21 @@ describe('recognize()', () => {
318
318
expect ( blocks [ 0 ] . paragraphs [ 0 ] . lines [ 0 ] . words [ 0 ] . text ) . to . be ( '繁體' ) ;
319
319
expect ( blocks [ 0 ] . paragraphs [ 0 ] . lines [ 0 ] . text ) . to . be ( '繁體 中 文 測試\n' ) ;
320
320
} ) . timeout ( TIMEOUT ) ;
321
+
322
+ it ( 'should report RowAttributes' , async ( ) => {
323
+ await worker . reinitialize ( 'eng' ) ;
324
+ const { data : { blocks } } = await worker . recognize ( `${ IMAGE_PATH } /testocr.png` , { } , { blocks : true } ) ;
325
+ const firstLine = blocks [ 0 ] . paragraphs [ 0 ] . lines [ 0 ] ;
326
+
327
+ expect ( firstLine . rowAttributes ) . to . be . an ( 'object' ) ;
328
+ expect ( firstLine . rowAttributes . ascenders ) . to . be . a ( 'number' ) ;
329
+ expect ( firstLine . rowAttributes . descenders ) . to . be . a ( 'number' ) ;
330
+ expect ( firstLine . rowAttributes . rowHeight ) . to . be . a ( 'number' ) ;
331
+
332
+ expect ( firstLine . rowAttributes . ascenders ) . to . be . greaterThan ( 0 ) ;
333
+ expect ( firstLine . rowAttributes . descenders ) . to . be . greaterThan ( 0 ) ;
334
+ expect ( firstLine . rowAttributes . rowHeight ) . to . be . greaterThan ( 0 ) ;
335
+ } ) . timeout ( TIMEOUT ) ;
321
336
} ) ;
322
337
323
338
describe ( 'should support layout blocks (json) output' , ( ) => {
You can’t perform that action at this time.
0 commit comments