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 {
4141 load_number_dawg : string
4242 load_bigram_dawg : string
4343 }
44-
44+
4545 type LoggerMessage = {
4646 jobId : string
4747 progress : number
4848 status : string
4949 userJobId : string
5050 workerId : string
5151 }
52-
52+
5353 interface WorkerOptions {
5454 corePath : string
5555 langPath : string
@@ -166,7 +166,7 @@ declare namespace Tesseract {
166166 interface RowAttributes {
167167 ascenders : number ;
168168 descenders : number ;
169- row_height : number ;
169+ rowHeight : number ;
170170 }
171171 interface Bbox {
172172 x0 : number ;
Original file line number Diff line number Diff line change @@ -318,6 +318,21 @@ describe('recognize()', () => {
318318 expect ( blocks [ 0 ] . paragraphs [ 0 ] . lines [ 0 ] . words [ 0 ] . text ) . to . be ( '繁體' ) ;
319319 expect ( blocks [ 0 ] . paragraphs [ 0 ] . lines [ 0 ] . text ) . to . be ( '繁體 中 文 測試\n' ) ;
320320 } ) . 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 ) ;
321336 } ) ;
322337
323338 describe ( 'should support layout blocks (json) output' , ( ) => {
You can’t perform that action at this time.
0 commit comments