Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename function to TessBaseAPIGetTsvText to be consistent to Create method #2286

Merged
merged 1 commit into from
Mar 10, 2019
Merged

Conversation

Shreeshrii
Copy link
Collaborator

No description provided.

@zdenop
Copy link
Contributor

zdenop commented Mar 3, 2019

Why? TSV is equivalent for CSV. Also C++ method use TSV. I never see Csv or Tsv. Search for TSV file...

@Shreeshrii
Copy link
Collaborator Author

Tsv is being used within tesseract already.

https://github.com/tesseract-ocr/tesseract/blob/master/src/api/renderer.cpp#L145

TessTsvRenderer::TessTsvRenderer(const char* outputbase)
    : TessResultRenderer(outputbase, "tsv") {
  font_info_ = false;
}

TessTsvRenderer::TessTsvRenderer(const char* outputbase, bool font_info)
    : TessResultRenderer(outputbase, "tsv") {
  font_info_ = font_info;
}

bool TessTsvRenderer::BeginDocumentHandler() {
  // Output TSV column headings
  AppendString(
      "level\tpage_num\tblock_num\tpar_num\tline_num\tword_"
      "num\tleft\ttop\twidth\theight\tconf\ttext\n");
  return true;
}

bool TessTsvRenderer::EndDocumentHandler() { return true; }

bool TessTsvRenderer::AddImageHandler(TessBaseAPI* api) {
  const std::unique_ptr<const char[]> tsv(api->GetTSVText(imagenum()));
  if (tsv == nullptr) return false;

  AppendString(tsv.get());

  return true;
}```

@zdenop
Copy link
Contributor

zdenop commented Mar 4, 2019

it is ok to have variable lower case (tsv). IMO Tsv should be corrected to TSV.

@amitdo
Copy link
Collaborator

amitdo commented Mar 4, 2019

Correcting the name in the C++ code will break the API.

@Shreeshrii
Copy link
Collaborator Author

My change was only for my earlier commit for C-API.

@amitdo
Copy link
Collaborator

amitdo commented Mar 4, 2019

Yes Shree, I know.

My comment was directed to Zdenko.

@zdenop
Copy link
Contributor

zdenop commented Mar 4, 2019

@amitdo: We already modified API
I really wonder if anybody use renderer part of API (e.g. storing output to disk) ;-) for simple formats like TSV or txt if they have access to ResultIterator...

@zdenop
Copy link
Contributor

zdenop commented Mar 10, 2019

@stwei : What is your opinion here?

@stweil
Copy link
Member

stweil commented Mar 10, 2019

If we think that the API is not used for TSV, then removing those API functions would be a simple solution.

Regarding upper and lower case: it's already a mess, as there is also TessAlto..., TessHOcr..., TessUnlv....

@Shreeshrii
Copy link
Collaborator Author

I think there are developers who would use it when available. Please see #2231 (comment)

Copy link
Member

@stweil stweil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The modification is in line with existing function names.

@zdenop zdenop merged commit 5cfe4cc into tesseract-ocr:master Mar 10, 2019
@Shreeshrii Shreeshrii deleted the lstmbox branch March 15, 2019 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants