1. 5
    AI tool to fix typos by generating a diff file? ask vibecoding

I am horrible at spelling in general, and English is not my native language, so my posts usually start full of trivial mistakes.

I’ve tried chat GPT manually, and it is pretty phenomenal at spotting exactly the issues I have in my writing.

However, I don’t actually use it, as manually applying its suggestions just takes too much time. The same goes for grammarly.

Is there a tool, where I can paste my text in, and get the output in git diff format, so that I can easily work with it from the comfort of my editor?

    1. 11

      Do you need an AI for this? Most editors I’ve seen highlight spelling and grammatical issues anyway. I have to imagine that most of them also have keystrokes for, “Show next highlighted error” and then, “Correct highlighted error.” I use vim for coding and that detects spelling errors and highlights things under the label SpellBad.

      1. 3

        I think I do! Here’s a fairly typical typo of mine:

        https://github.com/matklad/matklad.github.io/pull/167/files

        In this paragraph, Vim’s spellchecker highlight three things which are not errors. ChatGPT finds this error, and another one, and gets one false positive where it is confused my my markup (which feels like it should be solvable by adding some cleaning step before just pasting the thing in).

        I would also appreciate just a good quality dictionary based spell checker — the one in VS Code is pretty abysmal.

        1. 2

          I’m sure there’s some way to bolster vim’s spellchecker/grammar checker, because plugging that line into a google document (and I assume a word document would do this as well) correctly highlights that as a grammatical error. Getting a more robust grammar checker seems a lot easier than integrating a whole AI.

          1. 4

            I mean, from my perspective, be it a bald devil behind the scenes, as long as it fixes my problem. But I am pretty sure that google doc uses ML for checks: https://workspace.google.com/blog/productivity-collaboration/everyday-ai-beyond-spell-check-how-google-docs-is-smart-enough-to-correct-grammar

            1. 1

              Maybe a suboptimal example, but as a lifelong English + computers user, I can say that this kind of grammatical correction has existed in tech for a long time and I don’t believe is specific to google. I still think the simpler solution is finding an existing grammar checker for vim than an AI.

        2. 2

          Most editors I’ve seen highlight spelling and grammatical issues anyway

          … using an AI. Not traditionally an LLM, but certainly an AI nonetheless.

          1. 1

            These days, maybe, but something like “lose” vs. “loose” absolutely would have been caught by an editor 10-15 years ago. I have a hard time believing that these tools only ever existed in the world since AI’s came into vogue.

            1. 1

              I think maybe you’re taking a very narrow view of what an AI is. AI has existed as long as (maybe longer than?) computers. I’m pretty sure anything that can detect an English usage error (such as lose vs loose) is by definition an AI.

        3. 2

          I was going to suggest Grammarly (I have no affiliation), but it actually misses the “looses” vs. “loses” typo in your example: https://jyc-static.com/45c1ae0ff1ea9dbb24bb646c2d17b29ce89a7bd3e6135e417e72f1f53ed1f5b4

          It’s rule-based, not LLM-based, but I’ve heard of it very well for some friends for whom English is their second language.

          1. 2

            I just wrote a script with the function calling API that you might be able to use? https://gist.github.com/easrng/406c5204913f6fba71a85b488a18b029

            you can run it with deno like this: deno run --allow-env --allow-net https://gist.githubusercontent.com/easrng/406c5204913f6fba71a85b488a18b029/raw/8923b18ac3f7f2aa6f817c52442aff4b4a1ca559/gpt-spellcheck.ts

            1. 2

              Yup, of all the suggestions here, this is the closest to what I am looking for, kudos! Let’s hope that someone feels nerd-snipped enough to make this into an actual, polished tool!

              1. 1

                Thanks, on the surface, it looks exactly like what I need (up to being a deno script)! Will take a closer look once I sort my payment method with OpenAI.

              2. 2

                I haven’t tried it but simonw has written a whole bunch of stuff about LLMs and released various command line tools

                https://github.com/simonw/llm

                https://simonwillison.net/tags/llm/

                It feels like you basically want input -> model -> output => diff input output, which is naturally a shell script using some sort of CLI wrapper :-)

                I guess a cool thing would be to compare multiple models.

                Do you paste an entire blog post into chatgpt and get corrections?

                Personally I wrote a spell corrector against /usr/share/dict/words and it works pretty well :) It finds stuff in every doc

                1. 2

                  oh they deprecated that edit api, it would’ve been good for this. https://platform.openai.com/docs/api-reference/edits

                  1. 1

                    I’m using aspell in the terminal, including for HTML and LaTeX documents and it works. Start is annoying because you will have to teach it a bit of tech jargon, but not too much for my taste.

                    1. 1

                      I can recommend Deepl Write. It is based on deep learning, so it really understands your text, but doesnt make silly mistakes. Also it offers alternatives, when you are not satisfied with the suggestions. The translation service is also really great! I would even suggest that you could write the text in your native language, translate it and use it as is. I never had weird translations and in the pro version (which I dont have) you can even provide a custom dictionary.

                      1. 1

                        How do I use that effectively with my local editor? I want to avoid a dance where I copy text from my editor into some web-form, and than have to manually apply corrections.

                      2. 1

                        aider.chat can do this and even check it in automatically.

                        1. 1

                          Tried that, but it doesn’t look like it works all that well for prose:

                          • it fails to produce suggestions that can be applied automatically
                          • it looks like it doesn’t find all typos immediately?

                          This is the right general direction, but I need something more tailored specfically for typo correction in prose (I think the failure here is mostly because it tries to treat my file as code? At least it was also failing when loading tree sitter)