tesseract  4.00.00dev
tesseract::UnicodeSpanSkipper Class Reference

Public Member Functions

 UnicodeSpanSkipper (const UNICHARSET *unicharset, const WERD_CHOICE *word)
 
int SkipPunc (int pos)
 
int SkipDigits (int pos)
 
int SkipRomans (int pos)
 
int SkipAlpha (int pos)
 

Detailed Description

Definition at line 283 of file paragraphs.cpp.

Constructor & Destructor Documentation

◆ UnicodeSpanSkipper()

tesseract::UnicodeSpanSkipper::UnicodeSpanSkipper ( const UNICHARSET unicharset,
const WERD_CHOICE word 
)
inline

Definition at line 285 of file paragraphs.cpp.

286  : u_(unicharset), word_(word) { wordlen_ = word->length(); }
int length() const
Definition: ratngs.h:301

Member Function Documentation

◆ SkipAlpha()

int tesseract::UnicodeSpanSkipper::SkipAlpha ( int  pos)

Definition at line 324 of file paragraphs.cpp.

324  {
325  while (pos < wordlen_ && u_->get_isalpha(word_->unichar_id(pos))) pos++;
326  return pos;
327 }
UNICHAR_ID unichar_id(int index) const
Definition: ratngs.h:313

◆ SkipDigits()

int tesseract::UnicodeSpanSkipper::SkipDigits ( int  pos)

Definition at line 308 of file paragraphs.cpp.

308  {
309  while (pos < wordlen_ && (u_->get_isdigit(word_->unichar_id(pos)) ||
310  IsDigitLike(UnicodeFor(u_, word_, pos)))) pos++;
311  return pos;
312 }
UNICHAR_ID unichar_id(int index) const
Definition: ratngs.h:313
int UnicodeFor(const UNICHARSET *u, const WERD_CHOICE *werd, int pos)
Definition: paragraphs.cpp:275
bool IsDigitLike(int ch)
Definition: paragraphs.cpp:198
bool get_isdigit(UNICHAR_ID unichar_id) const
Definition: unicharset.h:472

◆ SkipPunc()

int tesseract::UnicodeSpanSkipper::SkipPunc ( int  pos)

Definition at line 303 of file paragraphs.cpp.

303  {
304  while (pos < wordlen_ && u_->get_ispunctuation(word_->unichar_id(pos))) pos++;
305  return pos;
306 }
UNICHAR_ID unichar_id(int index) const
Definition: ratngs.h:313

◆ SkipRomans()

int tesseract::UnicodeSpanSkipper::SkipRomans ( int  pos)

Definition at line 314 of file paragraphs.cpp.

314  {
315  const char *kRomans = "ivxlmdIVXLMD";
316  while (pos < wordlen_) {
317  int ch = UnicodeFor(u_, word_, pos);
318  if (ch >= 0xF0 || strchr(kRomans, ch) == 0) break;
319  pos++;
320  }
321  return pos;
322 }
int UnicodeFor(const UNICHARSET *u, const WERD_CHOICE *werd, int pos)
Definition: paragraphs.cpp:275

The documentation for this class was generated from the following file: