Word Count accuracy
I call this process of editing and rewriting "reflexive word adjustment".
Here's the code ChatGPT used to recalibrate the word count in Python:
# Word count of the initial essay initial_word_count = len(initial_essay.split())
# Target word count target_word_count = 300
# Calculate how many words to add/remove words_to_adjust = target_word_count — initial_word_count
# Output current word count and words to adjust initial_word_count, words_to_adjust
What's even more remarkable is how it ping-ponged back and forth — going from 255 to 315 to 304 to 302 — until it landed at exactly 300 words. And all of this without me adding a second prompt or having to manually adjust anything. All in one shot. It stayed on task until it nailed the word count.
Here's the prompt I used. I'm proud of it, so if you share it online, please credit the prompt engineering to me (and send the readers to Medium!):
Programmatically craft a precisely 500-word essay on [INSERT SUBJECT]. Ensure it's exactly 500 words before presenting it. If it is not 500 exactly, make minor adjustments to the length by adding/removing the amount needed to hit the target. Before making these adjustments, estimate the exact number of word to add/remove. Use manual segmentation. Make small incremental changes as needed, but keep a tally of each word as you add or remove it, in order to stay on budget.
[This isn't the final prompt. I'll demonstrate how I improved it for longer output. Be sure to read to the end of the article for the ultimate version!]