tesseract  4.0.0-1-g2a2b
tesseract::GeometricClassifierState Struct Reference

Public Member Functions

 GeometricClassifierState (int dbg_level, GenericVector< RowScratchRegisters > *r, int r_start, int r_end)
 
void AssumeLeftJustification ()
 
void AssumeRightJustification ()
 
const GenericVector< Cluster > & AlignTabs () const
 
const GenericVector< Cluster > & OffsideTabs () const
 
bool IsFullRow (int i) const
 
int AlignsideTabIndex (int row_idx) const
 
bool FirstWordWouldHaveFit (int row_a, int row_b)
 
void PrintRows () const
 
void Fail (int min_debug_level, const char *why) const
 
ParagraphModel Model () const
 

Public Attributes

int debug_level
 
GenericVector< RowScratchRegisters > * rows
 
int row_start
 
int row_end
 
int tolerance
 
bool ltr
 
GenericVector< Clusterleft_tabs
 
GenericVector< Clusterright_tabs
 
tesseract::ParagraphJustification just
 
int margin
 
int first_indent
 
int body_indent
 
int eop_threshold
 

Detailed Description

Definition at line 867 of file paragraphs.cpp.

Constructor & Destructor Documentation

◆ GeometricClassifierState()

tesseract::GeometricClassifierState::GeometricClassifierState ( int  dbg_level,
GenericVector< RowScratchRegisters > *  r,
int  r_start,
int  r_end 
)
inline

Definition at line 868 of file paragraphs.cpp.

871  : debug_level(dbg_level), rows(r), row_start(r_start), row_end(r_end),
872  margin(0) {
873  tolerance = InterwordSpace(*r, r_start, r_end);
874  CalculateTabStops(r, r_start, r_end, tolerance,
875  &left_tabs, &right_tabs);
876  if (debug_level >= 3) {
877  tprintf("Geometry: TabStop cluster tolerance = %d; "
878  "%d left tabs; %d right tabs\n",
879  tolerance, left_tabs.size(), right_tabs.size());
880  }
881  ltr = (*r)[r_start].ri_->ltr;
882  }
int InterwordSpace(const GenericVector< RowScratchRegisters > &rows, int row_start, int row_end)
GenericVector< Cluster > right_tabs
Definition: paragraphs.cpp:959
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37
GenericVector< RowScratchRegisters > * rows
Definition: paragraphs.cpp:945
GenericVector< Cluster > left_tabs
Definition: paragraphs.cpp:958

Member Function Documentation

◆ AlignsideTabIndex()

int tesseract::GeometricClassifierState::AlignsideTabIndex ( int  row_idx) const
inline

Definition at line 917 of file paragraphs.cpp.

917  {
918  return ClosestCluster(AlignTabs(), (*rows)[row_idx].AlignsideIndent(just));
919  }
const GenericVector< Cluster > & AlignTabs() const
Definition: paragraphs.cpp:895
tesseract::ParagraphJustification just
Definition: paragraphs.cpp:962
GenericVector< RowScratchRegisters > * rows
Definition: paragraphs.cpp:945

◆ AlignTabs()

const GenericVector<Cluster>& tesseract::GeometricClassifierState::AlignTabs ( ) const
inline

Definition at line 895 of file paragraphs.cpp.

895  {
897  return left_tabs;
898  }
GenericVector< Cluster > right_tabs
Definition: paragraphs.cpp:959
tesseract::ParagraphJustification just
Definition: paragraphs.cpp:962
GenericVector< Cluster > left_tabs
Definition: paragraphs.cpp:958

◆ AssumeLeftJustification()

void tesseract::GeometricClassifierState::AssumeLeftJustification ( )
inline

Definition at line 884 of file paragraphs.cpp.

◆ AssumeRightJustification()

void tesseract::GeometricClassifierState::AssumeRightJustification ( )
inline

Definition at line 889 of file paragraphs.cpp.

◆ Fail()

void tesseract::GeometricClassifierState::Fail ( int  min_debug_level,
const char *  why 
) const
inline

Definition at line 930 of file paragraphs.cpp.

930  {
931  if (debug_level < min_debug_level) return;
932  tprintf("# %s\n", why);
933  PrintRows();
934  }
DLLSYM void tprintf(const char *format,...)
Definition: tprintf.cpp:37

◆ FirstWordWouldHaveFit()

bool tesseract::GeometricClassifierState::FirstWordWouldHaveFit ( int  row_a,
int  row_b 
)
inline

Definition at line 923 of file paragraphs.cpp.

923  {
925  (*rows)[row_a], (*rows)[row_b], just);
926  }
tesseract::ParagraphJustification just
Definition: paragraphs.cpp:962
GenericVector< RowScratchRegisters > * rows
Definition: paragraphs.cpp:945
bool FirstWordWouldHaveFit(const RowScratchRegisters &before, const RowScratchRegisters &after)

◆ IsFullRow()

bool tesseract::GeometricClassifierState::IsFullRow ( int  i) const
inline

Definition at line 912 of file paragraphs.cpp.

912  {
913  return ClosestCluster(left_tabs, (*rows)[i].lindent_) == 0 &&
914  ClosestCluster(right_tabs, (*rows)[i].rindent_) == 0;
915  }
GenericVector< Cluster > right_tabs
Definition: paragraphs.cpp:959
GenericVector< RowScratchRegisters > * rows
Definition: paragraphs.cpp:945
GenericVector< Cluster > left_tabs
Definition: paragraphs.cpp:958

◆ Model()

ParagraphModel tesseract::GeometricClassifierState::Model ( ) const
inline

◆ OffsideTabs()

const GenericVector<Cluster>& tesseract::GeometricClassifierState::OffsideTabs ( ) const
inline

Definition at line 905 of file paragraphs.cpp.

905  {
907  return right_tabs;
908  }
GenericVector< Cluster > right_tabs
Definition: paragraphs.cpp:959
tesseract::ParagraphJustification just
Definition: paragraphs.cpp:962
GenericVector< Cluster > left_tabs
Definition: paragraphs.cpp:958

◆ PrintRows()

void tesseract::GeometricClassifierState::PrintRows ( ) const
inline

Definition at line 928 of file paragraphs.cpp.

928 { PrintRowRange(*rows, row_start, row_end); }
GenericVector< RowScratchRegisters > * rows
Definition: paragraphs.cpp:945

Member Data Documentation

◆ body_indent

int tesseract::GeometricClassifierState::body_indent

Definition at line 965 of file paragraphs.cpp.

◆ debug_level

int tesseract::GeometricClassifierState::debug_level

Definition at line 941 of file paragraphs.cpp.

◆ eop_threshold

int tesseract::GeometricClassifierState::eop_threshold

Definition at line 968 of file paragraphs.cpp.

◆ first_indent

int tesseract::GeometricClassifierState::first_indent

Definition at line 964 of file paragraphs.cpp.

◆ just

tesseract::ParagraphJustification tesseract::GeometricClassifierState::just

Definition at line 962 of file paragraphs.cpp.

◆ left_tabs

GenericVector<Cluster> tesseract::GeometricClassifierState::left_tabs

Definition at line 958 of file paragraphs.cpp.

◆ ltr

bool tesseract::GeometricClassifierState::ltr

Definition at line 954 of file paragraphs.cpp.

◆ margin

int tesseract::GeometricClassifierState::margin

Definition at line 963 of file paragraphs.cpp.

◆ right_tabs

GenericVector<Cluster> tesseract::GeometricClassifierState::right_tabs

Definition at line 959 of file paragraphs.cpp.

◆ row_end

int tesseract::GeometricClassifierState::row_end

Definition at line 947 of file paragraphs.cpp.

◆ row_start

int tesseract::GeometricClassifierState::row_start

Definition at line 946 of file paragraphs.cpp.

◆ rows

GenericVector<RowScratchRegisters>* tesseract::GeometricClassifierState::rows

Definition at line 945 of file paragraphs.cpp.

◆ tolerance

int tesseract::GeometricClassifierState::tolerance

Definition at line 950 of file paragraphs.cpp.


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