tesseract  4.0.0-1-g2a2b
tesseract::TessTsvRenderer Class Reference

#include <renderer.h>

Inheritance diagram for tesseract::TessTsvRenderer:
tesseract::TessResultRenderer

Public Member Functions

 TessTsvRenderer (const char *outputbase, bool font_info)
 
 TessTsvRenderer (const char *outputbase)
 
- Public Member Functions inherited from tesseract::TessResultRenderer
virtual ~TessResultRenderer ()
 
void insert (TessResultRenderer *next)
 
TessResultRenderernext ()
 
bool BeginDocument (const char *title)
 
bool AddImage (TessBaseAPI *api)
 
bool EndDocument ()
 
const char * file_extension () const
 
const char * title () const
 
bool happy ()
 
int imagenum () const
 

Protected Member Functions

virtual bool BeginDocumentHandler ()
 
virtual bool AddImageHandler (TessBaseAPI *api)
 
virtual bool EndDocumentHandler ()
 
- Protected Member Functions inherited from tesseract::TessResultRenderer
 TessResultRenderer (const char *outputbase, const char *extension)
 
void AppendString (const char *s)
 
void AppendData (const char *s, int len)
 

Detailed Description

Renders Tesseract output into a TSV string

Definition at line 172 of file renderer.h.

Constructor & Destructor Documentation

◆ TessTsvRenderer() [1/2]

tesseract::TessTsvRenderer::TessTsvRenderer ( const char *  outputbase,
bool  font_info 
)
explicit

Definition at line 204 of file renderer.cpp.

205  : TessResultRenderer(outputbase, "tsv") {
206  font_info_ = font_info;
207 }
TessResultRenderer(const char *outputbase, const char *extension)
Definition: renderer.cpp:33

◆ TessTsvRenderer() [2/2]

tesseract::TessTsvRenderer::TessTsvRenderer ( const char *  outputbase)
explicit

Definition at line 199 of file renderer.cpp.

200  : TessResultRenderer(outputbase, "tsv") {
201  font_info_ = false;
202 }
TessResultRenderer(const char *outputbase, const char *extension)
Definition: renderer.cpp:33

Member Function Documentation

◆ AddImageHandler()

bool tesseract::TessTsvRenderer::AddImageHandler ( TessBaseAPI api)
protectedvirtual

Implements tesseract::TessResultRenderer.

Definition at line 219 of file renderer.cpp.

219  {
220  const std::unique_ptr<const char[]> tsv(api->GetTSVText(imagenum()));
221  if (tsv == nullptr) return false;
222 
223  AppendString(tsv.get());
224 
225  return true;
226 }
void AppendString(const char *s)
Definition: renderer.cpp:102

◆ BeginDocumentHandler()

bool tesseract::TessTsvRenderer::BeginDocumentHandler ( )
protectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 209 of file renderer.cpp.

209  {
210  // Output TSV column headings
211  AppendString(
212  "level\tpage_num\tblock_num\tpar_num\tline_num\tword_"
213  "num\tleft\ttop\twidth\theight\tconf\ttext\n");
214  return true;
215 }
void AppendString(const char *s)
Definition: renderer.cpp:102

◆ EndDocumentHandler()

bool tesseract::TessTsvRenderer::EndDocumentHandler ( )
protectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 217 of file renderer.cpp.

217 { return true; }

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