~ubuntu-branches/ubuntu/vivid/tesseract/vivid

« back to all changes in this revision

Viewing changes to ccutil/tessdatamanager.h

  • Committer: Package Import Robot
  • Author(s): Jeff Breidenbach
  • Date: 2014-02-03 11:10:20 UTC
  • mfrom: (1.3.1) (19.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20140203111020-igquodd7pjlp3uri
Tags: 3.03.01-1
* New upstream release, includes critical fix to PDF rendering
* Complete leptonlib transition (see bug #735509)
* Promote from experimental to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
#define TESSERACT_CCUTIL_TESSDATAMANAGER_H_
22
22
 
23
23
#include <stdio.h>
 
24
 
24
25
#include "host.h"
 
26
#include "strngs.h"
25
27
#include "tprintf.h"
26
28
 
27
29
static const char kTrainedDataSuffix[] = "traineddata";
44
46
static const char kShapeTableFileSuffix[] = "shapetable";
45
47
static const char kBigramDawgFileSuffix[] = "bigram-dawg";
46
48
static const char kUnambigDawgFileSuffix[] = "unambig-dawg";
47
 
static const char kParamsTrainingModelFileSuffix[] = "params-training-model";
 
49
static const char kParamsModelFileSuffix[] = "params-model";
48
50
 
49
51
namespace tesseract {
50
52
 
59
61
  TESSDATA_SYSTEM_DAWG,         // 7
60
62
  TESSDATA_NUMBER_DAWG,         // 8
61
63
  TESSDATA_FREQ_DAWG,           // 9
62
 
  TESSDATA_FIXED_LENGTH_DAWGS,  // 10
 
64
  TESSDATA_FIXED_LENGTH_DAWGS,  // 10  // deprecated
63
65
  TESSDATA_CUBE_UNICHARSET,     // 11
64
66
  TESSDATA_CUBE_SYSTEM_DAWG,    // 12
65
67
  TESSDATA_SHAPE_TABLE,         // 13
66
68
  TESSDATA_BIGRAM_DAWG,         // 14
67
69
  TESSDATA_UNAMBIG_DAWG,        // 15
68
 
  TESSDATA_PARAMS_TRAINING_MODEL,  // 16
 
70
  TESSDATA_PARAMS_MODEL,        // 16
69
71
 
70
72
  TESSDATA_NUM_ENTRIES
71
73
};
85
87
  kSystemDawgFileSuffix,        // 7
86
88
  kNumberDawgFileSuffix,        // 8
87
89
  kFreqDawgFileSuffix,          // 9
88
 
  kFixedLengthDawgsFileSuffix,  // 10
 
90
  kFixedLengthDawgsFileSuffix,  // 10  // deprecated
89
91
  kCubeUnicharsetFileSuffix,    // 11
90
92
  kCubeSystemDawgFileSuffix,    // 12
91
93
  kShapeTableFileSuffix,        // 13
92
94
  kBigramDawgFileSuffix,        // 14
93
95
  kUnambigDawgFileSuffix,       // 15
94
 
  kParamsTrainingModelFileSuffix,  // 16
 
96
  kParamsModelFileSuffix,       // 16
95
97
};
96
98
 
97
99
/**
109
111
  false,                        // 7
110
112
  false,                        // 8
111
113
  false,                        // 9
112
 
  false,                        // 10
 
114
  false,                        // 10  // deprecated
113
115
  true,                         // 11
114
116
  false,                        // 12
115
117
  false,                        // 13
116
118
  false,                        // 14
117
119
  false,                        // 15
118
 
  false,                        // 16
 
120
  true,                         // 16
119
121
};
120
122
 
121
123
/**
146
148
   */
147
149
  bool Init(const char *data_file_name, int debug_level);
148
150
 
 
151
  // Return the name of the underlying data file.
 
152
  const STRING &GetDataFileName() const { return data_file_name_; }
 
153
 
149
154
  /** Returns data file pointer. */
150
155
  inline FILE *GetDataFilePtr() const { return data_file_; }
151
156
 
195
200
  }
196
201
 
197
202
  /** Writes the number of entries and the given offset table to output_file. */
198
 
  static void WriteMetadata(inT64 *offset_table, FILE *output_file);
 
203
  static void WriteMetadata(inT64 *offset_table,
 
204
                            const char *language_data_path_prefix,
 
205
                            FILE *output_file);
199
206
 
200
207
  /**
201
208
   * Reads all the standard tesseract config and data files for a language
277
284
   * when new tessdata types are introduced.
278
285
   */
279
286
  inT32 actual_tessdata_num_entries_;
 
287
  STRING data_file_name_;  // name of the data file.
280
288
  FILE *data_file_;  ///< pointer to the data file.
281
289
  int debug_level_;
282
290
  // True if the bytes need swapping.