Tesseract 3.02

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
lang_mod_edge.h
Go to the documentation of this file.
1 /**********************************************************************
2 * File: lang_mod_edge.h
3 * Description: Declaration of the Language Model Edge Base Class
4 * Author: Ahmad Abdulkader
5 * Created: 2007
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 LangModEdge abstracts an Edge in the language model trie
21 // This is an abstract class that any Language Model Edge should inherit from
22 // It provides methods for:
23 // 1- Returns the class ID corresponding to the edge
24 // 2- If the edge is a valid EndOfWord (EOW)
25 // 3- If the edge is coming from a OutOfDictionary (OOF) state machine
26 // 4- If the edge is a Terminal (has no children)
27 // 5- A Hash of the edge that will be used to retrieve the edge
28 // quickly from the BeamSearch lattice
29 // 6- If two edges are identcial
30 // 7- Returns a verbal description of the edge (use by debuggers)
31 // 8- the language model cost of the edge (if any)
32 // 9- The string corresponding to this edge
33 // 10- Getting and setting the "Root" status of the edge
34
35 #ifndef LANG_MOD_EDGE_H
36 #define LANG_MOD_EDGE_H
37
38 #include "cube_tuning_params.h"
39 #include "char_set.h"
40
41 namespace tesseract {
42
43 class LangModEdge {
44 public:
45 LangModEdge() {}
46 virtual ~LangModEdge() {}
47
48 // The string corresponding to this edge
49 virtual const char_32 * EdgeString() const = 0;
50 // Returns the class ID corresponding to the edge
51 virtual int ClassID() const = 0;
52 // If the edge is the root edge
53 virtual bool IsRoot() const = 0;
54 // Set the Root flag
55 virtual void SetRoot(bool flag) = 0;
56 // If the edge is a valid EndOfWord (EOW)
57 virtual bool IsEOW() const = 0;
58 // is the edge is coming from a OutOfDictionary (OOF) state machine
59 virtual bool IsOOD() const = 0;
60 // Is the edge is a Terminal (has no children)
61 virtual bool IsTerminal() const = 0;
62 // Returns A hash of the edge that will be used to retrieve the edge
63 virtual unsigned int Hash() const = 0;
64 // Are the two edges identcial?
65 virtual bool IsIdentical(LangModEdge *edge) const = 0;
66 // a verbal description of the edge (use by debuggers)
67 virtual char *Description() const = 0;
68 // the language model cost of the edge (if any)
69 virtual int PathCost() const = 0;
70 };
71 }
72
73 #endif // LANG_MOD_EDGE_H