Closed hdevalence closed 4 years ago
Hi @hdevalence,
I agree.
I've started a branch to play around with similar ideas. This commit in particular f31f8d76df72a79952d22e9bed00a45c87ec9ac6
When I finish it, may I add you as a reviewer?
In addition to being slightly nicer (imo) to write and read, it seems like there are also safety benefits, because you can provide a more misuse-resistant API (e.g., requiring the language parameter in
Ocr::new
).
Tesseract will quit your program (panic?) if you try and read the text before initializing it or assigning it an image https://github.com/antimatter15/tesseract-rs/issues/16. I'm going to see if I can solve that by using the type system to make the user call initialize and call set-image before getting the text. And a nice side effect of this is the methods will become chainable.
SGTM!
@hdevalence the pull request is ready for review https://github.com/antimatter15/tesseract-rs/pull/20 🙂
Hi, thanks for working on these bindings! While I was looking at the docs and some of the tests, I wondered whether the API might be slightly more ergonomic if the
Tesseract
struct had chainable methods and was consumed by the OCR call.For instance, if
Tesseract
hadthen users could write
instead of writing
as in the current implementation of the
ocr
function.In addition to being slightly nicer (imo) to write and read, it seems like there are also safety benefits, because you can provide a more misuse-resistant API (e.g., requiring the language parameter in
Ocr::new
).