Tesseract  3.02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
word_altlist.h
Go to the documentation of this file.
1 /**********************************************************************
2  * File: word_altlist.h
3  * Description: Declaration of the Word Alternate List Class
4  * Author: Ahmad Abdulkader
5  * Created: 2008
6  *
7  * (C) Copyright 2008, Google Inc.
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 // The WordAltList abstracts a alternate list of words and their corresponding
21 // costs that result from the word recognition process. The class inherits
22 // from the AltList class
23 // It provides methods to add a new word alternate, its corresponding score and
24 // a tag.
25 
26 #ifndef WORD_ALT_LIST_H
27 #define WORD_ALT_LIST_H
28 
29 #include "altlist.h"
30 
31 namespace tesseract {
32 class WordAltList : public AltList {
33  public:
34  explicit WordAltList(int max_alt);
35  ~WordAltList();
36  // Sort the list of alternates based on cost
37  void Sort();
38  // insert an alternate word with the specified cost and tag
39  bool Insert(char_32 *char_ptr, int cost, void *tag = NULL);
40  // returns the alternate string at the specified position
41  inline char_32 * Alt(int alt_idx) { return word_alt_[alt_idx]; }
42  // print each entry of the altlist, both UTF8 and unichar ids, and
43  // their costs, to stderr
44  void PrintDebug();
45  private:
46  char_32 **word_alt_;
47 };
48 } // namespace tesseract
49 
50 #endif // WORD_ALT_LIST_H