Tesseract
3.02
|
00001 /********************************************************************** 00002 * File: search_object.h 00003 * Description: Declaration of the Beam Search Object Class 00004 * Author: Ahmad Abdulkader 00005 * Created: 2008 00006 * 00007 * (C) Copyright 2008, Google Inc. 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 // The SearchObject class represents a char_samp (a word bitmap) that is 00021 // being searched for characters (or recognizeable entities). 00022 // This is an abstract class that all SearchObjects should inherit from 00023 // A SearchObject class provides methods to: 00024 // 1- Returns the count of segments 00025 // 2- Recognize a segment range 00026 // 3- Creates a CharSamp for a segment range 00027 00028 #ifndef SEARCH_OBJECT_H 00029 #define SEARCH_OBJECT_H 00030 00031 #include "char_altlist.h" 00032 #include "char_samp.h" 00033 #include "cube_reco_context.h" 00034 00035 namespace tesseract { 00036 class SearchObject { 00037 public: 00038 explicit SearchObject(CubeRecoContext *cntxt) { cntxt_ = cntxt; } 00039 virtual ~SearchObject() {} 00040 00041 virtual int SegPtCnt() = 0; 00042 virtual CharAltList *RecognizeSegment(int start_pt, int end_pt) = 0; 00043 virtual CharSamp *CharSample(int start_pt, int end_pt) = 0; 00044 virtual Box* CharBox(int start_pt, int end_pt) = 0; 00045 00046 virtual int SpaceCost(int seg_pt) = 0; 00047 virtual int NoSpaceCost(int seg_pt) = 0; 00048 virtual int NoSpaceCost(int start_pt, int end_pt) = 0; 00049 00050 protected: 00051 CubeRecoContext *cntxt_; 00052 }; 00053 } 00054 00055 #endif // SEARCH_OBJECT_H