-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Add language information to the TSV output (fixes #1861) #4168
base: main
Are you sure you want to change the base?
Conversation
Also make the font_info flag work on TSV output.
font_info has no reliable information (see e.g. https://github.com/tesseract-ocr/tesseract/issues?q=is%3Aissue+Font+Attribute+) so I doubt if it is a good idea to promote it in output |
Alright, do you want me to remove it from this PR? |
Yes. What is a use case for |
Nothing in particular. It was already present in the code and it is in the example TSV linked in #1861. |
Let me know if you want the commits to be squashed. (I do hope font information can be brought back into the engine in some moment.) |
@@ -564,7 +564,7 @@ class TESS_API TessBaseAPI { | |||
* page_number is 0-based but will appear in the output as 1-based. | |||
* Returned string must be freed with the delete [] operator. | |||
*/ | |||
char *GetTSVText(int page_number); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an API change. It requires a new major version (Tesseract 6.0.0) and changes in other software like for example tesserocr.
Therefore we cannot simply merge this pull request.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood. If you have a suggestion how to provide this functionality without modifying the API, I could steer the PR in that direction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use overload
char *GetTSVText(int page_number, bool lang_info=false);
to
char *GetTSVText(int page_number, bool lang_info);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have pushed the overload approach, it does not break the API now.
Sorry, I misunderstood your question. The use case for |
Also make the font_info flag work on TSV output.
The existing code was reading
hocr_font_info
but not using it when producing output. This PR fixes that, too but it feels a rather undocumented feature without reading the source code. I wonder where to document that. Maybe as a comment on thetsv
example config?