tesseract  5.0.0-alpha-619-ge9db
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

bool BeginDocumentHandler () override
 
bool AddImageHandler (TessBaseAPI *api) override
 
bool EndDocumentHandler () override
 
- 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 198 of file renderer.h.

Constructor & Destructor Documentation

◆ TessTsvRenderer() [1/2]

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

Definition at line 148 of file renderer.cpp.

152  : TessResultRenderer(outputbase, "tsv") {

◆ TessTsvRenderer() [2/2]

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

Definition at line 143 of file renderer.cpp.

147  : TessResultRenderer(outputbase, "tsv") {

Member Function Documentation

◆ AddImageHandler()

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

Implements tesseract::TessResultRenderer.

Definition at line 163 of file renderer.cpp.

164  { return true; }
165 
167  const std::unique_ptr<const char[]> tsv(api->GetTSVText(imagenum()));
168  if (tsv == nullptr) return false;
169 
170  AppendString(tsv.get());

◆ BeginDocumentHandler()

bool tesseract::TessTsvRenderer::BeginDocumentHandler ( )
overrideprotectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 153 of file renderer.cpp.

156  {
157  // Output TSV column headings
158  AppendString(
159  "level\tpage_num\tblock_num\tpar_num\tline_num\tword_"

◆ EndDocumentHandler()

bool tesseract::TessTsvRenderer::EndDocumentHandler ( )
overrideprotectedvirtual

Reimplemented from tesseract::TessResultRenderer.

Definition at line 161 of file renderer.cpp.


The documentation for this class was generated from the following files:
tesseract::TessTsvRenderer::AddImageHandler
bool AddImageHandler(TessBaseAPI *api) override
Definition: renderer.cpp:163
tesseract::TessResultRenderer::AppendString
void AppendString(const char *s)
Definition: renderer.cpp:101
tesseract::TessResultRenderer::TessResultRenderer
TessResultRenderer(const char *outputbase, const char *extension)
Definition: renderer.cpp:32
tesseract::TessResultRenderer::imagenum
int imagenum() const
Definition: renderer.h:107
TessBaseAPI
struct TessBaseAPI TessBaseAPI
Definition: capi.h:72