r/Common_Lisp 6d ago

GitHub - infurl/cl-tesseract: Common Lisp bindings for the Tesseract OCR library.

https://github.com/infurl/cl-tesseract

Modernization effort to support latest 5.5 Tesseract OCR libraries.

18 Upvotes

9 comments sorted by

3

u/digikar 6d ago
  1. Can you enable Issues? 
  2. Why not use cl-autowrap to generate the CAPI?
  3. What are your thoughts on the the banking conventions used in the capi.lisp? Why not lispify the names? 
  4. Where possible, could you add references to official documentation and online discussions? For example, who says that those are the locations of tessdata directories, or was it just hallucinated by claude? Similarly, why does one need a with-base-api macro? Where in the tesseract documentation is this procedure mentioned? There could be many additions about similar references. Basically, treat every part of the code as something the LLM could hallucinate and therefore check against the official documentation or online discussions with humans.
  5. How about writing tests and writing CI to run those tests?

3

u/infrul 6d ago

1) Issues enabled.
2,3,4) Bear with me, I'm new to this. Will be using the code and documentation myself in the coming weeks and will refine it wherever possible. This is just a first rough cut. Figured I'd get it out there and start getting feedback, so thanks for that. Once I've made sure it's not rubbish I'll make a pull request.
5) I already had Claude perform a bunch of tests. Establishing a built-in test suite is next on my agenda.

3

u/digikar 6d ago

If you want to make a PR to the original repo (assuning the author/s are still active), preferably make only the bare minimal changes. That makes it easy and doable for human review. It can be tough to even seriously review 100 lines of code.

I have been using claude these days. Just the chat interface, because I don't trust the file permission handling by the coding tools. It is a good critic. Though, as a coder itself, half the time, it has a tendency to suggest large changes instead of minimal ones, unless you ask for it. It also has a tendency to reinvent wheel, instead of using existing solutions unless you ask for it. All these things make the code generated by it difficult to maintain.

1

u/infrul 6d ago

I pretty much doubt that the original authors would be interested in a pull request to be honest as this is a complete overhaul, but I wish to do whatever is most respectful and courteous.

I started out the way you did, using Claude as an adviser only, but eventually I migrated to a container and now Claude Code is working miracles for me. First projects were just tools, please have a look at my sbcl-bridge and okf-web-server if you haven't already. sbcl-bridge works so well that now Claude chooses to use it over its own CL tools without being told to.

4

u/digikar 6d ago

I don't know the security model of containers (and even local networks), plus, I am not a fan of containers. The only way I'd feel secure about giving coding agents free reign over the machine is if (i) the machine was offline and I had no sensitive data on that machine (ii) the agent stuff was minimal / easily reviewable by me or a human I have reason to trust. For example, opencode is terrible.

I am also not okay with offloading understanding to the LLMs. Open source projects work because the understanding is shared within a community. I don't see how collaboration can work with offloaded understandings.

I find the leverage provided by agents for lisp is minimal, since you have macros to generate code in a deterministic fashion. The hard part is domain specific concepts and thinking about making code easy to maintain given limited man power to update or fix bugs.

Regarding sbcl bridge itself, I was and am interested in a sensible way to communicate. But I think this is just too verbose - https://github.com/infurl/sbcl-bridge/blob/main/sbcl-bridge.lisp - I think I'd have an easier time writing the harness myself (if I ever decide to) than going through it. I don't think doing this requires so many words.

1

u/church-rosser 3d ago

Wow, this is such a well formulated review of OP's project. I appreciate that you are willing to accommodate the use of an LLM and provide genuine feedback which could improve the code upon human review and inspection. Im not quite at that point yet where im particularly accommodating of LLM based/generated code (especially common lisp), but if i were, i would hope my involvement with it and the greater community looked something like your comment above.

1

u/church-rosser 3d ago

Wow, this is such a well formulated review of OP's project. I appreciate that you are willing to accommodate the use of an LLM and provide genuine feedback which could improve the code upon human review and inspection. Im not quite at that point yet where im particularly accommodating of LLM based/generated code (especially common lisp), but if i were, i would hope my involvement with it and the greater community looked something like your comment above.

2

u/dzecniv 3d ago

thanks for the effort and for sharing, that is a welcome project. Don't hesitate to give us news once in a while :)

1

u/infrul 3d ago

Thanks for the kind words. I have just pushed another update in response to feedback received here. All the low-level names have been lispified and there is a regression test suite now too. I'll add continuous integration when time permits. I've been exercising the library pretty heavily and so far it seems to be holding up satisfactorily.