Using GPT-3 to make regular expressions legible:
Aug 21, 2022 · 10:19 AM UTC
Also possible to make regexes from prose descriptions, but be careful! You can never fully trust GPT-3. Generate at low/zero temperature. Make sure output is verbose and easy for you to verify. GPT-3 often emits code that appears right but isn’t quite. Correct it via dialog.
Note my example here is, technically, very subtly wrong: It doesn’t match leap seconds. GPT-3 is a poor substitute for real wisdom.
Another quick demo, incrementally crafting a regex through instructional dialog. This is overkill for this one, obviously, but it illustrates how you can talk to it using examples, corrections, etc. Playground link: beta.openai.com/playground/p…
These dialogs are often productive in themselves, similar to “rubber duck debugging”. You learn through GPT-3’s misunderstandings how much the task was actually underspecified in your head.