tesseract
3.03
|
00001 /********************************************************************** 00002 * File: tessbox.cpp (Formerly tessbox.c) 00003 * Description: Black boxed Tess for developing a resaljet. 00004 * Author: Ray Smith 00005 * Created: Thu Apr 23 11:03:36 BST 1992 00006 * 00007 * (C) Copyright 1992, Hewlett-Packard Ltd. 00008 ** Licensed under the Apache License, Version 2.0 (the "License"); 00009 ** you may not use this file except in compliance with the License. 00010 ** You may obtain a copy of the License at 00011 ** http://www.apache.org/licenses/LICENSE-2.0 00012 ** Unless required by applicable law or agreed to in writing, software 00013 ** distributed under the License is distributed on an "AS IS" BASIS, 00014 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 ** See the License for the specific language governing permissions and 00016 ** limitations under the License. 00017 * 00018 **********************************************************************/ 00019 00020 #ifdef _MSC_VER 00021 #pragma warning(disable:4244) // Conversion warnings 00022 #endif 00023 00024 #include "mfoutline.h" 00025 #include "tessbox.h" 00026 #include "tesseractclass.h" 00027 00028 #define EXTERN 00029 00038 namespace tesseract { 00039 void Tesseract::tess_segment_pass_n(int pass_n, WERD_RES *word) { 00040 int saved_enable_assoc = 0; 00041 int saved_chop_enable = 0; 00042 00043 if (word->word->flag(W_DONT_CHOP)) { 00044 saved_enable_assoc = wordrec_enable_assoc; 00045 saved_chop_enable = chop_enable; 00046 wordrec_enable_assoc.set_value(0); 00047 chop_enable.set_value(0); 00048 } 00049 if (pass_n == 1) 00050 set_pass1(); 00051 else 00052 set_pass2(); 00053 recog_word(word); 00054 if (word->best_choice == NULL) 00055 word->SetupFake(*word->uch_set); 00056 if (word->word->flag(W_DONT_CHOP)) { 00057 wordrec_enable_assoc.set_value(saved_enable_assoc); 00058 chop_enable.set_value(saved_chop_enable); 00059 } 00060 } 00061 00069 bool Tesseract::tess_acceptable_word(WERD_RES* word) { 00070 return getDict().AcceptableResult(word); 00071 } 00072 00073 00079 void Tesseract::tess_add_doc_word(WERD_CHOICE *word_choice) { 00080 getDict().add_document_word(*word_choice); 00081 } 00082 } // namespace tesseract