chatgpt-shell icon indicating copy to clipboard operation
chatgpt-shell copied to clipboard

[Feature request] Suggesting/Edit-mode for ChatGPT response to help with proofreading texts

Open mfasold opened this issue 2 years ago • 5 comments

It might be a bit far-fetched, but per this reddit thread I still try to post my feature idea here.

The main concept is this: I would like to use ChatGPT to proofread texts using prompts like "Proofread this text: [TEXT]". Essentially, this would be a combination of spellcheck, grammar check, and style check. Some argue that it works better than Grammarly. The idea is that one could highlight a text in Emacs, send it to ChatGPT with the proofread prompt prefix, and receive a [PROOFREAD_TEXT]. It would then be useful to compare the [PROOFREAD_TEXT] with the original [TEXT], enabling the user to accept or decline each of the suggestions, similar to the suggest mode in text processors like Word, Google Docs, or Libre Office. The browser plugin EditGPT does this. It would be great to have a similar feature in Emacs. I believe that an edit-mode for ChatGPT-suggested changes could have many applications, including improving code, prose, and documentation.

mfasold avatar Jul 12 '23 10:07 mfasold

Thanks for filing the feature request. chatgpt-shell-proofread-region currently proofreads a region (presenting result in separate buffer), but lacks the interactive application of diff hunks. Do you happen to know another Emacs package that has this functionality (interactively apply patches)?

xenodium avatar Jul 14 '23 11:07 xenodium

I did some research, but - surprising enough - I did not find such a package. I was actually looking for the Grammar/Style checkers, but they mostly seem to rely on Flycheck to Flymake to mark the issues, without the possibility to apply patches.

Furthermore, I just did another search based on your freshly introduced keywords, and found that Emacs diff mode obviously supports interactive application of hunks.

My feeling is, however, that the line-based approach implicated by "diff hunks" would not work well as the proofread text might have a different line structure. Hence, one needs to identify the text changes using something like Levenshtein-Edits or the Needleman-Wunsch algorithm.

mfasold avatar Jul 14 '23 12:07 mfasold

You might find the new generic M-x chatgpt-shell-quick-modify-region useful. Beware: It's still very fresh.

proofread_x1 2

xenodium avatar Oct 16 '24 12:10 xenodium

Nice! It just tried and it works nicely. The highlighting of changes looks good, too. My first impression is that a point-by-point suggest/approve of changes could be beneficial for longer paragraphs. But I shall first test this new functionality for a couple of weeks to be able to judge if this is really so.

mfasold avatar Oct 23 '24 18:10 mfasold

I'm thinking along the same lines. Maybe extend the options of keep change? (y/n) to offer that interactivity. May take me a little while to get there. Working on internal cleanups to enable more things.

xenodium avatar Oct 23 '24 20:10 xenodium