• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**********************************************************************
2  * File:        wordseg.h  (Formerly wspace.h)
3  * Description: Code to segment the blobs into words.
4  * Author:		Ray Smith
5  * Created:		Fri Oct 16 11:32:28 BST 1992
6  *
7  * (C) Copyright 1992, Hewlett-Packard Ltd.
8  ** Licensed under the Apache License, Version 2.0 (the "License");
9  ** you may not use this file except in compliance with the License.
10  ** You may obtain a copy of the License at
11  ** http://www.apache.org/licenses/LICENSE-2.0
12  ** Unless required by applicable law or agreed to in writing, software
13  ** distributed under the License is distributed on an "AS IS" BASIS,
14  ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  ** See the License for the specific language governing permissions and
16  ** limitations under the License.
17  *
18  **********************************************************************/
19 
20 #ifndef           WORDSEG_H
21 #define           WORDSEG_H
22 
23 #include          "varable.h"
24 #include          "blobbox.h"
25 #include          "notdll.h"
26 
27 namespace tesseract {
28 class Tesseract;
29 }
30 
31 extern BOOL_VAR_H (textord_fp_chopping, TRUE, "Do fixed pitch chopping");
32 extern BOOL_VAR_H(textord_force_make_prop_words, FALSE,
33                   "Force proportional word segmentation on all rows");
34 extern BOOL_VAR_H (textord_chopper_test, FALSE,
35                    "Chopper is being tested.");
36 
37 void make_single_word(bool one_blob, TO_ROW_LIST *rows, ROW_LIST* real_rows);
38 void make_words(                             //make words
39                 ICOORD page_tr,              //top right
40                 float gradient,              //page skew
41                 BLOCK_LIST *blocks,          //block list
42                 TO_BLOCK_LIST *land_blocks,  //rotated for landscape
43                 TO_BLOCK_LIST *port_blocks,  //output list
44                 tesseract::Tesseract*
45                );
46 void set_row_spaces(                  //find space sizes
47                     TO_BLOCK *block,  //block to do
48                     FCOORD rotation,  //for drawing
49                     BOOL8 testing_on  //correct orientation
50                    );
51 inT32 row_words(                  //compute space size
52                 TO_BLOCK *block,  //block it came from
53                 TO_ROW *row,      //row to operate on
54                 inT32 maxwidth,   //max expected space size
55                 FCOORD rotation,  //for drawing
56                 BOOL8 testing_on  //for debug
57                );
58 inT32 row_words2(                  //compute space size
59                  TO_BLOCK *block,  //block it came from
60                  TO_ROW *row,      //row to operate on
61                  inT32 maxwidth,   //max expected space size
62                  FCOORD rotation,  //for drawing
63                  BOOL8 testing_on  //for debug
64                 );
65 void make_real_words(                  //find lines
66                      TO_BLOCK *block,  //block to do
67                      FCOORD rotation   //for drawing
68                     );
69 ROW *make_rep_words(                 //make a row
70                     TO_ROW *row,     //row to convert
71                     TO_BLOCK *block  //block it lives in
72                    );
73 WERD *make_real_word(                      //make a WERD
74                      BLOBNBOX_IT *box_it,  //iterator
75                      inT32 blobcount,      //no of blobs to use
76                      BOOL8 bol,            //start of line
77                      BOOL8 fuzzy_sp,       //fuzzy space
78                      BOOL8 fuzzy_non,      //fuzzy non-space
79                      uinT8 blanks          //no of blanks
80                     );
81 #endif
82 
83