tesseract  5.0.0-alpha-619-ge9db
validate_myanmar.h
Go to the documentation of this file.
1 #ifndef TESSERACT_TRAINING_VALIDATE_MYANMAR_H_
2 #define TESSERACT_TRAINING_VALIDATE_MYANMAR_H_
3 
4 #include "validator.h"
5 
6 namespace tesseract {
7 
8 // Subclass of Validator that validates and segments Myanmar.
9 class ValidateMyanmar : public Validator {
10  public:
11  ValidateMyanmar(ViramaScript script, bool report_errors)
12  : Validator(script, report_errors) {}
14 
15  protected:
16  // Returns whether codes matches the pattern for a Myanmar Grapheme.
17  // Consumes the next Grapheme in codes_[codes_used_++...] and copies it to
18  // parts_ and output_. Returns true if a valid Grapheme was consumed,
19  // otherwise does not increment codes_used_.
20  bool ConsumeGraphemeIfValid() override;
21  // Returns the CharClass corresponding to the given Unicode ch.
23 
24  private:
25  // Helper consumes/copies a virama and any subscript consonant.
26  // Returns true if the end of input is reached.
27  bool ConsumeSubscriptIfPresent();
28  // Helper consumes/copies a series of optional signs.
29  // Returns true if the end of input is reached.
30  bool ConsumeOptionalSignsIfPresent();
31  // Returns true if the unicode is a Myanmar "letter" including consonants
32  // and independent vowels. Although table 16-3 distinguishes between some
33  // base consonants and vowels, the extensions make no such distinction, so we
34  // put them all into a single bucket.
35  static bool IsMyanmarLetter(char32 ch);
36  // Returns true if ch is a Myanmar digit or other symbol that does not take
37  // part in being a syllable.
38  static bool IsMyanmarOther(char32 ch);
39 
40  // Some special unicodes used only for Myanmar processing.
41  static const char32 kMyanmarAsat = 0x103a;
42  static const char32 kMyanmarMedialYa = 0x103b;
43 };
44 
45 } // namespace tesseract
46 
47 #endif // TESSERACT_TRAINING_VALIDATE_MYANMAR_H_
tesseract::ValidateMyanmar::~ValidateMyanmar
~ValidateMyanmar()
Definition: validate_myanmar.h:13
tesseract::ValidateMyanmar
Definition: validate_myanmar.h:9
tesseract::ViramaScript
ViramaScript
Definition: validator.h:67
tesseract::ValidateMyanmar::UnicodeToCharClass
Validator::CharClass UnicodeToCharClass(char32 ch) const override
Definition: validate_myanmar.cpp:55
tesseract::ValidateMyanmar::ValidateMyanmar
ValidateMyanmar(ViramaScript script, bool report_errors)
Definition: validate_myanmar.h:11
tesseract::Validator::CharClass
CharClass
Definition: validator.h:126
validator.h
tesseract::char32
signed int char32
Definition: unichar.h:53
tesseract
Definition: baseapi.h:65
tesseract::ValidateMyanmar::ConsumeGraphemeIfValid
bool ConsumeGraphemeIfValid() override
Definition: validate_myanmar.cpp:13
tesseract::Validator
Definition: validator.h:86