mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 15:39:04 +08:00
Use using instead of typedef. Reason: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rt-using
This commit is contained in:
parent
0248c7ff9d
commit
0697235bb2
@ -88,7 +88,7 @@ struct LineHypothesis {
|
|||||||
|
|
||||||
class ParagraphTheory; // Forward Declaration
|
class ParagraphTheory; // Forward Declaration
|
||||||
|
|
||||||
typedef GenericVectorEqEq<const ParagraphModel *> SetOfModels;
|
using SetOfModels = GenericVectorEqEq<const ParagraphModel *>;
|
||||||
|
|
||||||
// Row Scratch Registers are data generated by the paragraph detection
|
// Row Scratch Registers are data generated by the paragraph detection
|
||||||
// algorithm based on a RowInfo input.
|
// algorithm based on a RowInfo input.
|
||||||
|
@ -71,7 +71,7 @@ struct TPOINT {
|
|||||||
int16_t x; // absolute x coord.
|
int16_t x; // absolute x coord.
|
||||||
int16_t y; // absolute y coord.
|
int16_t y; // absolute y coord.
|
||||||
};
|
};
|
||||||
typedef TPOINT VECTOR; // structure for coordinates.
|
using VECTOR = TPOINT; // structure for coordinates.
|
||||||
|
|
||||||
struct EDGEPT {
|
struct EDGEPT {
|
||||||
EDGEPT()
|
EDGEPT()
|
||||||
|
@ -120,7 +120,7 @@ class DetLineFit {
|
|||||||
// Type holds the distance of each point from the fitted line and the point
|
// Type holds the distance of each point from the fitted line and the point
|
||||||
// itself. Use of double allows integer distances from ICOORDs to be stored
|
// itself. Use of double allows integer distances from ICOORDs to be stored
|
||||||
// exactly, and also the floating point results from ConstrainedFit.
|
// exactly, and also the floating point results from ConstrainedFit.
|
||||||
typedef KDPairInc<double, ICOORD> DistPointPair;
|
using DistPointPair = KDPairInc<double, ICOORD>;
|
||||||
|
|
||||||
// Computes and returns the squared evaluation metric for a line fit.
|
// Computes and returns the squared evaluation metric for a line fit.
|
||||||
double EvaluateLineFit();
|
double EvaluateLineFit();
|
||||||
|
@ -628,6 +628,6 @@ struct MATRIX_COORD {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// The MatrixCoordPair contains a MATRIX_COORD and its priority.
|
// The MatrixCoordPair contains a MATRIX_COORD and its priority.
|
||||||
typedef tesseract::KDPairInc<float, MATRIX_COORD> MatrixCoordPair;
|
using MatrixCoordPair = tesseract::KDPairInc<float, MATRIX_COORD>;
|
||||||
|
|
||||||
#endif // TESSERACT_CCSTRUCT_MATRIX_H_
|
#endif // TESSERACT_CCSTRUCT_MATRIX_H_
|
||||||
|
@ -119,7 +119,7 @@ struct ParamsTrainingHypothesis {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// A list of hypotheses explored during one run of segmentation search.
|
// A list of hypotheses explored during one run of segmentation search.
|
||||||
typedef GenericVector<ParamsTrainingHypothesis> ParamsTrainingHypothesisList;
|
using ParamsTrainingHypothesisList = GenericVector<ParamsTrainingHypothesis>;
|
||||||
|
|
||||||
// A bundle that accumulates all of the hypothesis lists explored during all
|
// A bundle that accumulates all of the hypothesis lists explored during all
|
||||||
// of the runs of segmentation search on a word (e.g. a list of hypotheses
|
// of the runs of segmentation search on a word (e.g. a list of hypotheses
|
||||||
|
@ -637,7 +637,7 @@ class WERD_CHOICE : public ELIST_LINK {
|
|||||||
|
|
||||||
// Make WERD_CHOICE listable.
|
// Make WERD_CHOICE listable.
|
||||||
ELISTIZEH(WERD_CHOICE)
|
ELISTIZEH(WERD_CHOICE)
|
||||||
typedef GenericVector<BLOB_CHOICE_LIST *> BLOB_CHOICE_LIST_VECTOR;
|
using BLOB_CHOICE_LIST_VECTOR = GenericVector<BLOB_CHOICE_LIST *>;
|
||||||
|
|
||||||
// Utilities for comparing WERD_CHOICEs
|
// Utilities for comparing WERD_CHOICEs
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
T y p e s
|
T y p e s
|
||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
typedef float PRIORITY; /* PRIORITY */
|
using PRIORITY = float; /* PRIORITY */
|
||||||
|
|
||||||
class SEAM {
|
class SEAM {
|
||||||
public:
|
public:
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
typedef GenericVector<UNICHAR_ID> UnicharIdVector;
|
using UnicharIdVector = GenericVector<UNICHAR_ID>;
|
||||||
|
|
||||||
static const int kUnigramAmbigsBufferSize = 1000;
|
static const int kUnigramAmbigsBufferSize = 1000;
|
||||||
static const char kAmbigNgramSeparator[] = { ' ', '\0' };
|
static const char kAmbigNgramSeparator[] = { ' ', '\0' };
|
||||||
@ -138,7 +138,7 @@ ELISTIZEH(AmbigSpec)
|
|||||||
|
|
||||||
// AMBIG_TABLE[i] stores a set of ambiguities whose
|
// AMBIG_TABLE[i] stores a set of ambiguities whose
|
||||||
// wrong ngram starts with unichar id i.
|
// wrong ngram starts with unichar id i.
|
||||||
typedef GenericVector<AmbigSpec_LIST *> UnicharAmbigsVector;
|
using UnicharAmbigsVector = GenericVector<AmbigSpec_LIST *>;
|
||||||
|
|
||||||
class UnicharAmbigs {
|
class UnicharAmbigs {
|
||||||
public:
|
public:
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
#include <cstdint> // int32_t, ...
|
#include <cstdint> // int32_t, ...
|
||||||
|
|
||||||
// definitions of portable data types (numbers and characters)
|
// definitions of portable data types (numbers and characters)
|
||||||
typedef float FLOAT32;
|
using FLOAT32 = float;
|
||||||
typedef double FLOAT64;
|
using FLOAT64 = double;
|
||||||
typedef unsigned char BOOL8;
|
using BOOL8 = unsigned char;
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
|
@ -176,7 +176,7 @@ struct KDPtrPairDec : public KDPtrPair<Key, Data> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Specialization for a pair of ints in increasing order.
|
// Specialization for a pair of ints in increasing order.
|
||||||
typedef KDPairInc<int, int> IntKDPair;
|
using IntKDPair = KDPairInc<int, int>;
|
||||||
|
|
||||||
// Vector of IntKDPair.
|
// Vector of IntKDPair.
|
||||||
class KDVector : public GenericVector<IntKDPair> {
|
class KDVector : public GenericVector<IntKDPair> {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
|
|
||||||
// TODO(rays) Move these to the tesseract namespace.
|
// TODO(rays) Move these to the tesseract namespace.
|
||||||
// A UNICHAR_ID is the unique id of a unichar.
|
// A UNICHAR_ID is the unique id of a unichar.
|
||||||
typedef int UNICHAR_ID;
|
using UNICHAR_ID = int;
|
||||||
|
|
||||||
// A variable to indicate an invalid or uninitialized unichar id.
|
// A variable to indicate an invalid or uninitialized unichar id.
|
||||||
static const int INVALID_UNICHAR_ID = -1;
|
static const int INVALID_UNICHAR_ID = -1;
|
||||||
@ -49,7 +49,7 @@ enum StrongScriptDirection {
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
typedef signed int char32;
|
using char32 = signed int;
|
||||||
|
|
||||||
// The UNICHAR class holds a single classification result. This may be
|
// The UNICHAR class holds a single classification result. This may be
|
||||||
// a single Unicode character (stored as between 1 and 4 utf8 bytes) or
|
// a single Unicode character (stored as between 1 and 4 utf8 bytes) or
|
||||||
@ -106,7 +106,7 @@ class UNICHAR {
|
|||||||
// tprintf("Char = %s\n", buf);
|
// tprintf("Char = %s\n", buf);
|
||||||
// }
|
// }
|
||||||
class const_iterator {
|
class const_iterator {
|
||||||
typedef const_iterator CI;
|
using CI = const_iterator ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Step to the next UTF8 character.
|
// Step to the next UTF8 character.
|
||||||
|
@ -44,9 +44,9 @@ static int RadicalPreHash(const std::vector<int>& rs) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A hash map to convert unicodes to radical encoding.
|
// A hash map to convert unicodes to radical encoding.
|
||||||
typedef std::unordered_map<int, std::unique_ptr<std::vector<int>>> RSMap;
|
using RSMap = std::unordered_map<int, std::unique_ptr<std::vector<int>>>;
|
||||||
// A hash map to count occurrences of each radical encoding.
|
// A hash map to count occurrences of each radical encoding.
|
||||||
typedef std::unordered_map<int, int> RSCounts;
|
using RSCounts = std::unordered_map<int, int>;
|
||||||
|
|
||||||
static bool DecodeRadicalLine(STRING* radical_data_line, RSMap* radical_map) {
|
static bool DecodeRadicalLine(STRING* radical_data_line, RSMap* radical_map) {
|
||||||
if (radical_data_line->length() == 0 || (*radical_data_line)[0] == '#')
|
if (radical_data_line->length() == 0 || (*radical_data_line)[0] == '#')
|
||||||
|
@ -164,8 +164,8 @@ struct TEMPCLUSTER {
|
|||||||
CLUSTER *Neighbor;
|
CLUSTER *Neighbor;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef tesseract::KDPairInc<float, TEMPCLUSTER*> ClusterPair;
|
using ClusterPair = tesseract::KDPairInc<float, TEMPCLUSTER*>;
|
||||||
typedef tesseract::GenericHeap<ClusterPair> ClusterHeap;
|
using ClusterHeap = tesseract::GenericHeap<ClusterPair>;
|
||||||
|
|
||||||
struct STATISTICS {
|
struct STATISTICS {
|
||||||
FLOAT32 AvgVariance;
|
FLOAT32 AvgVariance;
|
||||||
|
@ -43,14 +43,14 @@ struct CHAR_DESC_STRUCT {
|
|||||||
uint32_t NumFeatureSets;
|
uint32_t NumFeatureSets;
|
||||||
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES];
|
FEATURE_SET FeatureSets[NUM_FEATURE_TYPES];
|
||||||
};
|
};
|
||||||
typedef CHAR_DESC_STRUCT *CHAR_DESC;
|
using CHAR_DESC = CHAR_DESC_STRUCT *;
|
||||||
|
|
||||||
struct FEATURE_DEFS_STRUCT {
|
struct FEATURE_DEFS_STRUCT {
|
||||||
int32_t NumFeatureTypes;
|
int32_t NumFeatureTypes;
|
||||||
const FEATURE_DESC_STRUCT* FeatureDesc[NUM_FEATURE_TYPES];
|
const FEATURE_DESC_STRUCT* FeatureDesc[NUM_FEATURE_TYPES];
|
||||||
int FeatureEnabled[NUM_FEATURE_TYPES];
|
int FeatureEnabled[NUM_FEATURE_TYPES];
|
||||||
};
|
};
|
||||||
typedef FEATURE_DEFS_STRUCT *FEATURE_DEFS;
|
using FEATURE_DEFS = FEATURE_DEFS_STRUCT *;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Generic functions for manipulating character descriptions
|
Generic functions for manipulating character descriptions
|
||||||
|
@ -30,7 +30,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
FLOAT32 x, y;
|
FLOAT32 x, y;
|
||||||
} FPOINT;
|
} FPOINT;
|
||||||
typedef FPOINT FVECTOR;
|
using FVECTOR = FPOINT;
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/**----------------------------------------------------------------------------
|
||||||
Macros
|
Macros
|
||||||
|
@ -58,26 +58,26 @@ struct FEATURE_DESC_STRUCT {
|
|||||||
const char *ShortName; // short name for feature
|
const char *ShortName; // short name for feature
|
||||||
const PARAM_DESC *ParamDesc; // array - one per param
|
const PARAM_DESC *ParamDesc; // array - one per param
|
||||||
};
|
};
|
||||||
typedef FEATURE_DESC_STRUCT *FEATURE_DESC;
|
using FEATURE_DESC = FEATURE_DESC_STRUCT *;
|
||||||
|
|
||||||
struct FEATURE_STRUCT {
|
struct FEATURE_STRUCT {
|
||||||
const FEATURE_DESC_STRUCT *Type; // points to description of feature type
|
const FEATURE_DESC_STRUCT *Type; // points to description of feature type
|
||||||
FLOAT32 Params[1]; // variable size array - params for feature
|
FLOAT32 Params[1]; // variable size array - params for feature
|
||||||
};
|
};
|
||||||
typedef FEATURE_STRUCT *FEATURE;
|
using FEATURE = FEATURE_STRUCT *;
|
||||||
|
|
||||||
struct FEATURE_SET_STRUCT {
|
struct FEATURE_SET_STRUCT {
|
||||||
uint16_t NumFeatures; // number of features in set
|
uint16_t NumFeatures; // number of features in set
|
||||||
uint16_t MaxNumFeatures; // maximum size of feature set
|
uint16_t MaxNumFeatures; // maximum size of feature set
|
||||||
FEATURE Features[1]; // variable size array of features
|
FEATURE Features[1]; // variable size array of features
|
||||||
};
|
};
|
||||||
typedef FEATURE_SET_STRUCT *FEATURE_SET;
|
using FEATURE_SET = FEATURE_SET_STRUCT *;
|
||||||
|
|
||||||
// A generic character description as a char pointer. In reality, it will be
|
// A generic character description as a char pointer. In reality, it will be
|
||||||
// a pointer to some data structure. Paired feature extractors/matchers need
|
// a pointer to some data structure. Paired feature extractors/matchers need
|
||||||
// to agree on the data structure to be used, however, the high level
|
// to agree on the data structure to be used, however, the high level
|
||||||
// classifier does not need to know the details of this data structure.
|
// classifier does not need to know the details of this data structure.
|
||||||
typedef char *CHAR_FEATURES;
|
using CHAR_FEATURES = char *;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
Macros for defining the parameters of a new features
|
Macros for defining the parameters of a new features
|
||||||
|
@ -37,7 +37,7 @@
|
|||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
T y p e s
|
T y p e s
|
||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
typedef BIT_VECTOR *CONFIGS;
|
using CONFIGS = BIT_VECTOR *;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ typedef struct
|
|||||||
FLOAT32 Angle;
|
FLOAT32 Angle;
|
||||||
FLOAT32 Length;
|
FLOAT32 Length;
|
||||||
} PROTO_STRUCT;
|
} PROTO_STRUCT;
|
||||||
typedef PROTO_STRUCT *PROTO;
|
using PROTO = PROTO_STRUCT *;
|
||||||
|
|
||||||
struct CLASS_STRUCT {
|
struct CLASS_STRUCT {
|
||||||
CLASS_STRUCT()
|
CLASS_STRUCT()
|
||||||
@ -64,8 +64,8 @@ struct CLASS_STRUCT {
|
|||||||
CONFIGS Configurations;
|
CONFIGS Configurations;
|
||||||
UnicityTableEqEq<int> font_set;
|
UnicityTableEqEq<int> font_set;
|
||||||
};
|
};
|
||||||
typedef CLASS_STRUCT *CLASS_TYPE;
|
using CLASS_TYPE = CLASS_STRUCT *;
|
||||||
typedef CLASS_STRUCT *CLASSES;
|
using CLASSES = CLASS_STRUCT *;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
C o n s t a n t s
|
C o n s t a n t s
|
||||||
|
@ -153,7 +153,7 @@ struct ShapeQueueEntry {
|
|||||||
// Which level in the tree did this come from?
|
// Which level in the tree did this come from?
|
||||||
int level;
|
int level;
|
||||||
};
|
};
|
||||||
typedef GenericHeap<ShapeQueueEntry> ShapeQueue;
|
using ShapeQueue = GenericHeap<ShapeQueueEntry>;
|
||||||
|
|
||||||
// Simple struct to hold a set of fonts associated with a single unichar-id.
|
// Simple struct to hold a set of fonts associated with a single unichar-id.
|
||||||
// A vector of UnicharAndFonts makes a shape.
|
// A vector of UnicharAndFonts makes a shape.
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
-----------------------------------------------------------------------------*/
|
-----------------------------------------------------------------------------*/
|
||||||
// TODO(rays) Rename BITSINLONG to BITSINuint32_t, and use sizeof.
|
// TODO(rays) Rename BITSINLONG to BITSINuint32_t, and use sizeof.
|
||||||
#define BITSINLONG 32 /**< no of bits in a long */
|
#define BITSINLONG 32 /**< no of bits in a long */
|
||||||
typedef uint32_t *BIT_VECTOR;
|
using BIT_VECTOR = uint32_t *;
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------
|
/*-----------------------------------------------------------------------------
|
||||||
Public Function Prototypes
|
Public Function Prototypes
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
#define NOERROR 0
|
#define NOERROR 0
|
||||||
#define DO_NOTHING 0
|
#define DO_NOTHING 0
|
||||||
|
|
||||||
typedef int TRAPERROR;
|
using TRAPERROR = int;
|
||||||
typedef void (*VOID_PROC) ();
|
typedef void (*VOID_PROC) ();
|
||||||
|
|
||||||
/**----------------------------------------------------------------------------
|
/**----------------------------------------------------------------------------
|
||||||
|
@ -129,7 +129,7 @@ struct list_rec
|
|||||||
struct list_rec *node;
|
struct list_rec *node;
|
||||||
struct list_rec *next;
|
struct list_rec *next;
|
||||||
};
|
};
|
||||||
typedef list_rec *LIST;
|
using LIST = list_rec *;
|
||||||
|
|
||||||
/*----------------------------------------------------------------------
|
/*----------------------------------------------------------------------
|
||||||
M a c r o s
|
M a c r o s
|
||||||
|
@ -50,11 +50,11 @@
|
|||||||
----------------------------------------------------------------------*/
|
----------------------------------------------------------------------*/
|
||||||
class UNICHARSET;
|
class UNICHARSET;
|
||||||
|
|
||||||
typedef uint64_t EDGE_RECORD;
|
using EDGE_RECORD = uint64_t;
|
||||||
typedef EDGE_RECORD *EDGE_ARRAY;
|
using EDGE_ARRAY = EDGE_RECORD *;
|
||||||
typedef int64_t EDGE_REF;
|
using EDGE_REF = int64_t;
|
||||||
typedef int64_t NODE_REF;
|
using NODE_REF = int64_t;
|
||||||
typedef EDGE_REF *NODE_MAP;
|
using NODE_MAP = EDGE_REF *;
|
||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
@ -65,9 +65,9 @@ struct NodeChild {
|
|||||||
NodeChild(): unichar_id(INVALID_UNICHAR_ID), edge_ref(NO_EDGE) {}
|
NodeChild(): unichar_id(INVALID_UNICHAR_ID), edge_ref(NO_EDGE) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef GenericVector<NodeChild> NodeChildVector;
|
using NodeChildVector = GenericVector<NodeChild>;
|
||||||
typedef GenericVector<int> SuccessorList;
|
using SuccessorList = GenericVector<int>;
|
||||||
typedef GenericVector<SuccessorList *> SuccessorListsVector;
|
using SuccessorListsVector = GenericVector<SuccessorList *>;
|
||||||
|
|
||||||
enum DawgType {
|
enum DawgType {
|
||||||
DAWG_TYPE_PUNCTUATION,
|
DAWG_TYPE_PUNCTUATION,
|
||||||
|
@ -46,7 +46,7 @@ struct CHAR_FRAGMENT_INFO {
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
typedef GenericVector<Dawg *> DawgVector;
|
using DawgVector = GenericVector<Dawg *>;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Constants
|
// Constants
|
||||||
|
@ -32,19 +32,19 @@
|
|||||||
#define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
|
#define MAX_CLASS_ID (MAX_NUM_CLASSES - 1)
|
||||||
|
|
||||||
/** a CLASS_ID is the ascii character to be associated with a class */
|
/** a CLASS_ID is the ascii character to be associated with a class */
|
||||||
typedef UNICHAR_ID CLASS_ID;
|
using CLASS_ID = UNICHAR_ID;
|
||||||
#define NO_CLASS (0)
|
#define NO_CLASS (0)
|
||||||
|
|
||||||
/** a PROTO_ID is the index of a prototype within it's class. Valid proto
|
/** a PROTO_ID is the index of a prototype within it's class. Valid proto
|
||||||
id's are 0 to N-1 where N is the number of prototypes that make up the
|
id's are 0 to N-1 where N is the number of prototypes that make up the
|
||||||
class. */
|
class. */
|
||||||
typedef int16_t PROTO_ID;
|
using PROTO_ID = int16_t;
|
||||||
#define NO_PROTO (-1)
|
#define NO_PROTO (-1)
|
||||||
|
|
||||||
/** FEATURE_ID is the index of a feature within a character description
|
/** FEATURE_ID is the index of a feature within a character description
|
||||||
The feature id ranges from 0 to N-1 where N is the number
|
The feature id ranges from 0 to N-1 where N is the number
|
||||||
of features in a character description. */
|
of features in a character description. */
|
||||||
typedef uint8_t FEATURE_ID;
|
using FEATURE_ID = uint8_t;
|
||||||
#define NO_FEATURE 255
|
#define NO_FEATURE 255
|
||||||
#define NOISE_FEATURE 254
|
#define NOISE_FEATURE 254
|
||||||
#define MISSING_PROTO 254
|
#define MISSING_PROTO 254
|
||||||
@ -53,13 +53,13 @@ typedef uint8_t FEATURE_ID;
|
|||||||
|
|
||||||
/** a RATING is the match rating returned by a classifier.
|
/** a RATING is the match rating returned by a classifier.
|
||||||
Higher is better. */
|
Higher is better. */
|
||||||
typedef FLOAT32 RATING;
|
using RATING = FLOAT32;
|
||||||
|
|
||||||
/** a CERTAINTY is an indication of the degree of confidence of the
|
/** a CERTAINTY is an indication of the degree of confidence of the
|
||||||
classifier. Higher is better. 0 means the match is as good as the
|
classifier. Higher is better. 0 means the match is as good as the
|
||||||
mean of the matches seen in training. -1 means the match was one
|
mean of the matches seen in training. -1 means the match was one
|
||||||
standard deviation worse than the training matches, etc. */
|
standard deviation worse than the training matches, etc. */
|
||||||
typedef FLOAT32 CERTAINTY;
|
using CERTAINTY = FLOAT32;
|
||||||
|
|
||||||
/** define a data structure to hold a single match result */
|
/** define a data structure to hold a single match result */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
|
|
||||||
class WERD_CHOICE;
|
class WERD_CHOICE;
|
||||||
|
|
||||||
typedef uint8_t BLOB_WIDTH;
|
using BLOB_WIDTH = uint8_t;
|
||||||
|
|
||||||
struct DANGERR_INFO {
|
struct DANGERR_INFO {
|
||||||
DANGERR_INFO() :
|
DANGERR_INFO() :
|
||||||
@ -44,7 +44,7 @@ struct DANGERR_INFO {
|
|||||||
UNICHAR_ID leftmost; // in the replacement, what's the leftmost character?
|
UNICHAR_ID leftmost; // in the replacement, what's the leftmost character?
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef GenericVector<DANGERR_INFO> DANGERR;
|
using DANGERR = GenericVector<DANGERR_INFO>;
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -41,15 +41,15 @@ class UNICHARSET;
|
|||||||
// It might be cleanest to change the types of most of the Trie/Dawg related
|
// It might be cleanest to change the types of most of the Trie/Dawg related
|
||||||
// typedefs to int and restrict the casts to extracting these values from
|
// typedefs to int and restrict the casts to extracting these values from
|
||||||
// the 64 bit EDGE_RECORD.
|
// the 64 bit EDGE_RECORD.
|
||||||
typedef int64_t EDGE_INDEX; // index of an edge in a given node
|
using EDGE_INDEX = int64_t ; // index of an edge in a given node
|
||||||
typedef bool *NODE_MARKER;
|
using NODE_MARKER = bool *;
|
||||||
typedef GenericVector<EDGE_RECORD> EDGE_VECTOR;
|
using EDGE_VECTOR = GenericVector<EDGE_RECORD> ;
|
||||||
|
|
||||||
struct TRIE_NODE_RECORD {
|
struct TRIE_NODE_RECORD {
|
||||||
EDGE_VECTOR forward_edges;
|
EDGE_VECTOR forward_edges;
|
||||||
EDGE_VECTOR backward_edges;
|
EDGE_VECTOR backward_edges;
|
||||||
};
|
};
|
||||||
typedef GenericVector<TRIE_NODE_RECORD *> TRIE_NODES;
|
using TRIE_NODES = GenericVector<TRIE_NODE_RECORD *> ;
|
||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
|
@ -1243,7 +1243,7 @@ double LSTMTrainer::ComputeCharError(const GenericVector<int>& truth_str,
|
|||||||
// Computes word recall error rate using a very simple bag of words algorithm.
|
// Computes word recall error rate using a very simple bag of words algorithm.
|
||||||
// NOTE that this is destructive on both input strings.
|
// NOTE that this is destructive on both input strings.
|
||||||
double LSTMTrainer::ComputeWordError(STRING* truth_str, STRING* ocr_str) {
|
double LSTMTrainer::ComputeWordError(STRING* truth_str, STRING* ocr_str) {
|
||||||
typedef std::unordered_map<std::string, int, std::hash<std::string> > StrMap;
|
using StrMap = std::unordered_map<std::string, int, std::hash<std::string>>;
|
||||||
GenericVector<STRING> truth_words, ocr_words;
|
GenericVector<STRING> truth_words, ocr_words;
|
||||||
truth_str->split(' ', &truth_words);
|
truth_str->split(' ', &truth_words);
|
||||||
if (truth_words.empty()) return 0.0;
|
if (truth_words.empty()) return 0.0;
|
||||||
|
@ -169,8 +169,8 @@ struct RecodeNode {
|
|||||||
uint64_t code_hash;
|
uint64_t code_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef KDPairInc<double, RecodeNode> RecodePair;
|
using RecodePair = KDPairInc<double, RecodeNode>;
|
||||||
typedef GenericHeap<RecodePair> RecodeHeap;
|
using RecodeHeap = GenericHeap<RecodePair>;
|
||||||
|
|
||||||
// Class that holds the entire beam search for recognition of a text line.
|
// Class that holds the entire beam search for recognition of a text line.
|
||||||
class RecodeBeamSearch {
|
class RecodeBeamSearch {
|
||||||
@ -262,7 +262,7 @@ class RecodeBeamSearch {
|
|||||||
// all of the step.
|
// all of the step.
|
||||||
RecodeNode best_initial_dawgs_[NC_COUNT];
|
RecodeNode best_initial_dawgs_[NC_COUNT];
|
||||||
};
|
};
|
||||||
typedef KDPairInc<float, int> TopPair;
|
using TopPair = KDPairInc<float, int>;
|
||||||
|
|
||||||
// Generates debug output of the content of a single beam position.
|
// Generates debug output of the content of a single beam position.
|
||||||
void DebugBeamPos(const UNICHARSET& unicharset, const RecodeHeap& heap) const;
|
void DebugBeamPos(const UNICHARSET& unicharset, const RecodeHeap& heap) const;
|
||||||
|
@ -28,7 +28,7 @@ CLISTIZEH(BLOBNBOX)
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
typedef GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> BlobGridSearch;
|
using BlobGridSearch = GridSearch<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT>;
|
||||||
|
|
||||||
class BlobGrid : public BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> {
|
class BlobGrid : public BBGrid<BLOBNBOX, BLOBNBOX_CLIST, BLOBNBOX_C_IT> {
|
||||||
public:
|
public:
|
||||||
|
@ -925,9 +925,9 @@ class ColPartition : public ELIST2_LINK {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Typedef it now in case it becomes a class later.
|
// Typedef it now in case it becomes a class later.
|
||||||
typedef GridSearch<ColPartition,
|
using ColPartitionGridSearch = GridSearch<ColPartition,
|
||||||
ColPartition_CLIST,
|
ColPartition_CLIST,
|
||||||
ColPartition_C_IT> ColPartitionGridSearch;
|
ColPartition_C_IT> ;
|
||||||
|
|
||||||
} // namespace tesseract.
|
} // namespace tesseract.
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ namespace tesseract {
|
|||||||
class WorkingPartSet_LIST;
|
class WorkingPartSet_LIST;
|
||||||
class ColSegment_LIST;
|
class ColSegment_LIST;
|
||||||
class ColPartitionSet;
|
class ColPartitionSet;
|
||||||
typedef GenericVector<ColPartitionSet*> PartSetVector;
|
using PartSetVector = GenericVector<ColPartitionSet*>;
|
||||||
|
|
||||||
// ColPartitionSet is a class that holds a list of ColPartitions.
|
// ColPartitionSet is a class that holds a list of ColPartitions.
|
||||||
// Its main use is in holding a candidate partitioning of the width of the
|
// Its main use is in holding a candidate partitioning of the width of the
|
||||||
|
@ -33,7 +33,7 @@ struct Pix;
|
|||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
typedef TessResultCallback1<bool, int> WidthCallback;
|
using WidthCallback = TessResultCallback1<bool, int>;
|
||||||
|
|
||||||
struct AlignedBlobParams;
|
struct AlignedBlobParams;
|
||||||
class ColPartitionGrid;
|
class ColPartitionGrid;
|
||||||
|
@ -113,12 +113,12 @@ class ColSegment : public ELIST_LINK {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Typedef BBGrid of ColSegments
|
// Typedef BBGrid of ColSegments
|
||||||
typedef BBGrid<ColSegment,
|
using ColSegmentGrid = BBGrid<ColSegment,
|
||||||
ColSegment_CLIST,
|
ColSegment_CLIST,
|
||||||
ColSegment_C_IT> ColSegmentGrid;
|
ColSegment_C_IT>;
|
||||||
typedef GridSearch<ColSegment,
|
using ColSegmentGridSearch = GridSearch<ColSegment,
|
||||||
ColSegment_CLIST,
|
ColSegment_CLIST,
|
||||||
ColSegment_C_IT> ColSegmentGridSearch;
|
ColSegment_C_IT>;
|
||||||
|
|
||||||
// TableFinder is a utility class to find a set of tables given a set of
|
// TableFinder is a utility class to find a set of tables given a set of
|
||||||
// ColPartitions and Columns. The TableFinder will mark candidate ColPartitions
|
// ColPartitions and Columns. The TableFinder will mark candidate ColPartitions
|
||||||
|
@ -62,8 +62,8 @@ class WordWithBox {
|
|||||||
|
|
||||||
// Make it usable by BBGrid.
|
// Make it usable by BBGrid.
|
||||||
CLISTIZEH(WordWithBox)
|
CLISTIZEH(WordWithBox)
|
||||||
typedef BBGrid<WordWithBox, WordWithBox_CLIST, WordWithBox_C_IT> WordGrid;
|
using WordGrid = BBGrid<WordWithBox, WordWithBox_CLIST, WordWithBox_C_IT>;
|
||||||
typedef GridSearch<WordWithBox, WordWithBox_CLIST, WordWithBox_C_IT> WordSearch;
|
using WordSearch = GridSearch<WordWithBox, WordWithBox_CLIST, WordWithBox_C_IT>;
|
||||||
|
|
||||||
class Textord {
|
class Textord {
|
||||||
public:
|
public:
|
||||||
|
@ -57,7 +57,7 @@ typedef struct
|
|||||||
int NumMerged[MAX_NUM_PROTOS];
|
int NumMerged[MAX_NUM_PROTOS];
|
||||||
CLASS_TYPE Class;
|
CLASS_TYPE Class;
|
||||||
}MERGE_CLASS_NODE;
|
}MERGE_CLASS_NODE;
|
||||||
typedef MERGE_CLASS_NODE* MERGE_CLASS;
|
using MERGE_CLASS = MERGE_CLASS_NODE*;
|
||||||
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -33,7 +33,7 @@ namespace tesseract {
|
|||||||
class PangoFontInfo; // defined in pango_font_info.h
|
class PangoFontInfo; // defined in pango_font_info.h
|
||||||
|
|
||||||
// Map to substitute strings for ligatures.
|
// Map to substitute strings for ligatures.
|
||||||
typedef std::unordered_map<std::string, std::string, StringHash> LigHash;
|
using LigHash = std::unordered_map<std::string, std::string, StringHash>;
|
||||||
|
|
||||||
class LigatureTable {
|
class LigatureTable {
|
||||||
public:
|
public:
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
DECLARE_STRING_PARAM_FLAG(fonts_dir);
|
DECLARE_STRING_PARAM_FLAG(fonts_dir);
|
||||||
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
|
DECLARE_STRING_PARAM_FLAG(fontconfig_tmpdir);
|
||||||
|
|
||||||
typedef signed int char32;
|
using char32 = signed int;
|
||||||
|
|
||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class Validator {
|
|||||||
kWhitespace = ' ',
|
kWhitespace = ' ',
|
||||||
kCombiner = 'c', // Combiners other than virama.
|
kCombiner = 'c', // Combiners other than virama.
|
||||||
};
|
};
|
||||||
typedef std::pair<CharClass, char32> IndicPair;
|
using IndicPair = std::pair<CharClass, char32>;
|
||||||
|
|
||||||
Validator(ViramaScript script, bool report_errors)
|
Validator(ViramaScript script, bool report_errors)
|
||||||
: script_(script),
|
: script_(script),
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
---------------------------------------------------------------------*/
|
---------------------------------------------------------------------*/
|
||||||
#define MAX_NUM_POINTS 50
|
#define MAX_NUM_POINTS 50
|
||||||
// The PointPair elements do NOT own the EDGEPTs.
|
// The PointPair elements do NOT own the EDGEPTs.
|
||||||
typedef tesseract::KDPairInc<float, EDGEPT*> PointPair;
|
using PointPair = tesseract::KDPairInc<float, EDGEPT*>;
|
||||||
typedef tesseract::GenericHeap<PointPair> PointHeap;
|
using PointHeap = tesseract::GenericHeap<PointPair>;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -35,10 +35,10 @@
|
|||||||
#include "chop.h"
|
#include "chop.h"
|
||||||
|
|
||||||
// The SeamPair elements own their SEAMs and delete them upon destruction.
|
// The SeamPair elements own their SEAMs and delete them upon destruction.
|
||||||
typedef tesseract::KDPtrPairInc<float, SEAM> SeamPair;
|
using SeamPair = tesseract::KDPtrPairInc<float, SEAM>;
|
||||||
typedef tesseract::GenericHeap<SeamPair> SeamQueue;
|
using SeamQueue = tesseract::GenericHeap<SeamPair>;
|
||||||
|
|
||||||
typedef tesseract::KDPtrPairDec<float, SEAM> SeamDecPair;
|
using SeamDecPair = tesseract::KDPtrPairDec<float, SEAM>;
|
||||||
typedef tesseract::GenericHeap<SeamDecPair> SeamPile;
|
using SeamPile = tesseract::GenericHeap<SeamDecPair>;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
// Heap of pain points used for determining where to chop/join.
|
// Heap of pain points used for determining where to chop/join.
|
||||||
typedef GenericHeap<MatrixCoordPair> PainPointHeap;
|
using PainPointHeap = GenericHeap<MatrixCoordPair>;
|
||||||
|
|
||||||
// Types of pain points (ordered in the decreasing level of importance).
|
// Types of pain points (ordered in the decreasing level of importance).
|
||||||
enum LMPainPointsType {
|
enum LMPainPointsType {
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
namespace tesseract {
|
namespace tesseract {
|
||||||
|
|
||||||
/// Used for expressing various language model flags.
|
/// Used for expressing various language model flags.
|
||||||
typedef unsigned char LanguageModelFlagsType;
|
using LanguageModelFlagsType = unsigned char;
|
||||||
|
|
||||||
/// The following structs are used for storing the state of the language model
|
/// The following structs are used for storing the state of the language model
|
||||||
/// in the segmentation search graph. In this graph the nodes are BLOB_CHOICEs
|
/// in the segmentation search graph. In this graph the nodes are BLOB_CHOICEs
|
||||||
|
Loading…
Reference in New Issue
Block a user