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