xenodium / chatgpt-shell

ChatGPT and DALL-E Emacs shells + Org babel 🦄 + a shell maker for other providers
https://xenodium.com
GNU General Public License v3.0
811 stars 73 forks source link

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

Open mfasold opened 1 year ago

mfasold commented 1 year ago

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.

xenodium commented 1 year ago

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)?

mfasold commented 1 year ago

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.