Amir Sharif
Engineer.
Weekend hacker.
Self improvement enthusiast.

Getting AI To Write Like Me

Take a large chunk of your writing. Lucky for me, I have all my blog posts and journal entries. Unfortunately, it’s a ton of code examples as well, AI would probably infer the wrong thing if I just threw all my files at it.

My filesMy files

How do I get all of these *.md and turn them into just prose?

I asked ChatGPT to make a Bash 1 liner for me and I ran it in the folder.

for f in *.md; do cat "$f"; echo -e "\n\n"; done > combined.txt

My combined.txt file still had non-prose and it was 40K tokens. I can’t throw this into ChatGPT (it’s too long), but Perplexity didn’t mind. I used this prompt:

The content of Text is Markdown.

- Delete anything that is in a code block. 
  - Example: `example` -> <CODE>
  - Example: ```ruby -> This is the start of a code block, so remove this until the ending ```
- If there is a link, replace it with the placeholder "<LINK>".
  - Example: [link](someurl.com) -> <LINK>
  - Example: someurl.com -> <LINK>

Respond only with the modified text. No yapping. No help messages.

Once you’re done that, use this prompt to extract your writing style. I took this from Twitter.

You are tasked with analyzing a piece of text to identify its style and tone. The text you will analyze is as follows:

<user_text>

</user_text>

Your goal is to determine which style and tone categories best describe this text. Here are the categories to consider:

Style Categories:
1. Sentence Structure: Staccato, Flowing, or Mixed
2. Vocabulary: Simple, Advanced, Technical, or Playful
3. Literary Devices: Metaphor-rich, Analogy-driven, Question-based, or Storytelling
4. Formatting: Listicle-style, Essay format, Dialogue-based, or Visually-driven
5. Perspective: First-person, Second-person, or Third-person

Tone Categories:
1. Emotional Color: Enthusiastic, Serious, Humorous, or Empathetic
2. Formality: Casual, Professional, or Academic
3. Attitude: Optimistic, Skeptical, Neutral, or Authoritative
4. Intensity: Mild, Moderate, or Passionate

Carefully read and analyze the provided text. Consider each category and determine which option best describes the text. Use a scratchpad to organize your initial thoughts and observations.

<scratchpad>
[Use this space to note your observations and thoughts about the text's style and tone]
</scratchpad>

After your analysis, provide your final assessment. For each category, choose the most appropriate option and provide a brief justification for your choice. Your response should be structured as follows:

<analysis>
Style:
1. Sentence Structure: [Your choice]
Justification: [Brief explanation]

2. Vocabulary: [Your choice]
Justification: [Brief explanation]

3. Literary Devices: [Your choice]
Justification: [Brief explanation]

4. Formatting: [Your choice]
Justification: [Brief explanation]

5. Perspective: [Your choice]
Justification: [Brief explanation]

Tone:
1. Emotional Color: [Your choice]
Justification: [Brief explanation]

2. Formality: [Your choice]
Justification: [Brief explanation]

3. Attitude: [Your choice]
Justification: [Brief explanation]

4. Intensity: [Your choice]
Justification: [Brief explanation]
</analysis>

Ensure that your justifications are concise but specific, referencing elements from the text that support your choices. If a category is particularly difficult to determine or if multiple options seem equally applicable, you may note this in your justification.

Add the Tone and Style section the next time you want to write something. Then write the thing yourself, and reprompt it with the writing and make it compare it. As it gets it wrong, you can ask:

Here's what I actually ended up writing. Can you tell me how I could have changed your prompt so you would have written more in my style?

And update the system prompt.

After a while it’ll start to understand your voice.


Tags
AI

Date
October 27, 2024