Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
tessbox.cpp
Go to the documentation of this file.
1 /**********************************************************************
2  * File: tessbox.cpp (Formerly tessbox.c)
3  * Description: Black boxed Tess for developing a resaljet.
4  * Author: Ray Smith
5  * Created: Thu Apr 23 11:03:36 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 #ifdef _MSC_VER
21 #pragma warning(disable:4244) // Conversion warnings
22 #endif
23 
24 #include "mfcpch.h"
25 #include "tfacep.h"
26 #include "tfacepp.h"
27 #include "tessbox.h"
28 #include "mfoutline.h"
29 #include "tesseractclass.h"
30 
31 #define EXTERN
32 
41 namespace tesseract {
43  BLOB_CHOICE_LIST_CLIST *blob_choices) {
44  int saved_enable_assoc = 0;
45  int saved_chop_enable = 0;
46 
47  if (word->word->flag(W_DONT_CHOP)) {
48  saved_enable_assoc = wordrec_enable_assoc;
49  saved_chop_enable = chop_enable;
50  wordrec_enable_assoc.set_value(0);
51  chop_enable.set_value(0);
52  if (word->word->flag(W_REP_CHAR))
53  getDict().permute_only_top.set_value(true);
54  }
55  set_pass1();
56  recog_word(word, blob_choices);
57  if (word->word->flag(W_DONT_CHOP)) {
58  wordrec_enable_assoc.set_value(saved_enable_assoc);
59  chop_enable.set_value(saved_chop_enable);
60  getDict().permute_only_top.set_value(false);
61  }
62 }
63 
64 
74  BLOB_CHOICE_LIST_CLIST *blob_choices) {
75  int saved_enable_assoc = 0;
76  int saved_chop_enable = 0;
77 
78  if (word->word->flag(W_DONT_CHOP)) {
79  saved_enable_assoc = wordrec_enable_assoc;
80  saved_chop_enable = chop_enable;
81  wordrec_enable_assoc.set_value(0);
82  chop_enable.set_value(0);
83  if (word->word->flag(W_REP_CHAR))
84  getDict().permute_only_top.set_value(true);
85  }
86  set_pass2();
87  recog_word(word, blob_choices);
88  if (word->word->flag(W_DONT_CHOP)) {
89  wordrec_enable_assoc.set_value(saved_enable_assoc);
90  chop_enable.set_value(saved_chop_enable);
91  getDict().permute_only_top.set_value(false);
92  }
93 }
94 
103  WERD_CHOICE *word_choice, // after context
104  WERD_CHOICE *raw_choice) { // before context
105  return getDict().AcceptableResult(*word_choice);
106 }
107 
108 
115  getDict().add_document_word(*word_choice);
116 }
117 } // namespace tesseract
unsigned char BOOL8
Definition: host.h:113
void set_pass2()
Definition: tface.cpp:105
BOOL8 flag(WERD_FLAGS mask) const
Definition: werd.h:122
BOOL8 tess_acceptable_word(WERD_CHOICE *word_choice, WERD_CHOICE *raw_choice)
Definition: tessbox.cpp:102
Dict & getDict()
Definition: classify.h:62
WERD * word
Definition: pageres.h:334
void add_document_word(const WERD_CHOICE &best_choice)
Adds a word found on this document to the document specific dictionary.
Definition: dict.cpp:690
bool AcceptableResult(const WERD_CHOICE &BestChoice)
Definition: stopper.cpp:254
void set_pass1()
Definition: tface.cpp:93
bool wordrec_enable_assoc
Definition: wordrec.h:98
void tess_add_doc_word(WERD_CHOICE *word_choice)
Definition: tessbox.cpp:114
void tess_segment_pass2(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
Definition: tessbox.cpp:73
void recog_word(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
Definition: tfacepp.cpp:54
bool permute_only_top
Definition: dict.h:910
void tess_segment_pass1(WERD_RES *word, BLOB_CHOICE_LIST_CLIST *blob_choices)
Definition: tessbox.cpp:42