tesseract  5.0.0-alpha-619-ge9db
tesseract::ValidateJavanese Class Reference

#include <validate_javanese.h>

Inheritance diagram for tesseract::ValidateJavanese:
tesseract::Validator

Public Member Functions

 ValidateJavanese (ViramaScript script, bool report_errors)
 
 ~ValidateJavanese ()
 
- Public Member Functions inherited from tesseract::Validator
virtual ~Validator ()
 

Protected Member Functions

bool ConsumeGraphemeIfValid () override
 
Validator::CharClass UnicodeToCharClass (char32 ch) const override
 
- Protected Member Functions inherited from tesseract::Validator
 Validator (ViramaScript script, bool report_errors)
 
bool ValidateCleanAndSegmentInternal (GraphemeNormMode g_mode, const std::vector< char32 > &src, std::vector< std::vector< char32 >> *dest)
 
void MoveResultsToDest (GraphemeNormMode g_mode, std::vector< std::vector< char32 >> *dest)
 
bool IsSubscriptScript () const
 
bool CodeOnlyToOutput ()
 
void MultiCodePart (unsigned length)
 
bool UseMultiCode (unsigned length)
 
void ComputeClassCodes (const std::vector< char32 > &text)
 
void Clear ()
 

Additional Inherited Members

- Static Public Member Functions inherited from tesseract::Validator
static bool ValidateCleanAndSegment (GraphemeNormMode g_mode, bool report_errors, const std::vector< char32 > &src, std::vector< std::vector< char32 >> *dest)
 
static bool IsZeroWidthMark (char32 ch)
 
- Static Public Attributes inherited from tesseract::Validator
static const char32 kZeroWidthSpace = 0x200B
 
static const char32 kZeroWidthNonJoiner = 0x200C
 
static const char32 kZeroWidthJoiner = 0x200D
 
static const char32 kLeftToRightMark = 0x200E
 
static const char32 kRightToLeftMark = 0x200F
 
static const char32 kInvalid = 0xfffd
 
- Protected Types inherited from tesseract::Validator
enum  CharClass {
  CharClass::kConsonant = 'C', CharClass::kVowel = 'V', CharClass::kVirama = 'H', CharClass::kMatra = 'M',
  CharClass::kMatraPiece = 'P', CharClass::kVowelModifier = 'D', CharClass::kZeroWidthNonJoiner = 'z', CharClass::kZeroWidthJoiner = 'Z',
  CharClass::kVedicMark = 'v', CharClass::kNukta = 'N', CharClass::kRobat = 'R', CharClass::kOther = 'O',
  CharClass::kWhitespace = ' ', CharClass::kCombiner = 'c'
}
 
using IndicPair = std::pair< CharClass, char32 >
 
- Static Protected Member Functions inherited from tesseract::Validator
static std::unique_ptr< ValidatorScriptValidator (ViramaScript script, bool report_errors)
 
static ViramaScript MostFrequentViramaScript (const std::vector< char32 > &utf32)
 
static bool IsVirama (char32 unicode)
 
static bool IsVedicAccent (char32 unicode)
 
- Protected Attributes inherited from tesseract::Validator
ViramaScript script_
 
std::vector< IndicPaircodes_
 
std::vector< std::vector< char32 > > parts_
 
std::vector< char32output_
 
unsigned codes_used_
 
unsigned output_used_
 
bool report_errors_
 
- Static Protected Attributes inherited from tesseract::Validator
static const int kIndicCodePageSize = 128
 
static const char32 kMinIndicUnicode = 0x900
 
static const char32 kMaxSinhalaUnicode = 0xdff
 
static const char32 kMaxViramaScriptUnicode = 0x17ff
 
static const char32 kSinhalaVirama = 0xdca
 
static const char32 kMyanmarVirama = 0x1039
 
static const char32 kKhmerVirama = 0x17d2
 
static const char32 kJavaneseVirama = 0xa9c0
 
static const char32 kMaxJavaneseUnicode = 0xa9df
 

Detailed Description

Definition at line 43 of file validate_javanese.h.

Constructor & Destructor Documentation

◆ ValidateJavanese()

tesseract::ValidateJavanese::ValidateJavanese ( ViramaScript  script,
bool  report_errors 
)
inline

Definition at line 60 of file validate_javanese.h.

◆ ~ValidateJavanese()

tesseract::ValidateJavanese::~ValidateJavanese ( )
inline

Definition at line 62 of file validate_javanese.h.

Member Function Documentation

◆ ConsumeGraphemeIfValid()

bool tesseract::ValidateJavanese::ConsumeGraphemeIfValid ( )
overrideprotectedvirtual

Implements tesseract::Validator.

Definition at line 53 of file validate_javanese.cpp.

53  :
54  UseMultiCode(1);
55  return true;
56  default:
57  if (report_errors_) {
58  tprintf("Invalid start of grapheme sequence:%c=0x%x\n",
59  codes_[codes_used_].first, codes_[codes_used_].second);
60  }
61  return false;
62  }
63 }
64 
65 // Helper consumes/copies a virama and any associated post-virama joiners.
66 // A linking virama (with either type of pre-virama joiner, post-virama ZWJ, or
67 // no joiner at all) must be followed by a consonant.
68 // A non-linking (explicit) virama is indicated by a ZWNJ after it, or a non
69 // consonant, space, or character from a different script. We clean up the
70 // representation to make it consistent by adding a ZWNJ if missing from a
71 // non-linking virama. Returns false with an invalid sequence.
72 bool ValidateJavanese::ConsumeViramaIfValid(IndicPair joiner, bool post_matra) {
73  const unsigned num_codes = codes_.size();
74  if (joiner.first == CharClass::kOther) {
76  if (codes_used_ < num_codes &&
77  codes_[codes_used_].second == kZeroWidthJoiner) {

◆ UnicodeToCharClass()

Validator::CharClass tesseract::ValidateJavanese::UnicodeToCharClass ( char32  ch) const
overrideprotectedvirtual

Implements tesseract::Validator.

Definition at line 270 of file validate_javanese.cpp.


The documentation for this class was generated from the following files:
tesseract::Validator::UseMultiCode
bool UseMultiCode(unsigned length)
Definition: validator.h:210
tesseract::Validator::IndicPair
std::pair< CharClass, char32 > IndicPair
Definition: validator.h:148
tesseract::Validator::codes_
std::vector< IndicPair > codes_
Definition: validator.h:246
tesseract::Validator::kZeroWidthJoiner
static const char32 kZeroWidthJoiner
Definition: validator.h:111
tesseract::Validator::report_errors_
bool report_errors_
Definition: validator.h:256
tesseract::Validator::codes_used_
unsigned codes_used_
Definition: validator.h:252
tesseract::Validator::CodeOnlyToOutput
bool CodeOnlyToOutput()
Definition: validator.h:186
tprintf
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:34
tesseract::Validator::CharClass::kOther