DEV Community

 AI Automation Enterenpeur

Find Your Top Repeat Questions with 20 Lines of Python

If you run a product, a course, or a community, you probably answer the same questions over and over. Each reply is small, but together they eat hours.

I use a simple rule: when a question shows up 3 times, it stops being a DM and becomes a public post, pinned in the community and shared as a link from then on.

The hard part is knowing which questions repeat. Your memory is biased toward the most recent ones. So let's let a script count them.

The input

Export your messages (or paste them in) to a CSV called dms.csv with a single column named message:

message
How do I get started?
how do i get started??
Is there a replay of the call?
Which tool do you use for email?
Is there a replay?
Enter fullscreen mode Exit fullscreen mode

Most platforms let you export messages, or you can copy the last month by hand. Twenty to fifty rows is enough to see patterns.

The script

import csv
import re
from collections import Counter

def normalize(text):
    text = text.lower()
    text = re.sub(r"[^a-z0-9\s]", "", text)
    stop = {"the", "a", "an", "of", "is", "there", "do", "i", "you", "for", "to"}
    words = [w for w in text.split() if w not in stop]
    return " ".join(sorted(set(words)))

counts = Counter()
examples = {}

with open("dms.csv", newline="", encoding="utf-8") as f:
    for row in csv.DictReader(f):
        msg = row["message"].strip()
        if not msg:
            continue
        key = normalize(msg)
        counts[key] += 1
        examples.setdefault(key, msg)

print("Questions asked 3+ times (write a post for these):")
for key, n in counts.most_common():
    if n >= 3:
        print(f"{n}x  {examples[key]}")
Enter fullscreen mode Exit fullscreen mode

How it works

normalize() lowercases each message, strips punctuation, drops filler words, and sorts the remaining words. That way "How do I get started?" and "how do i get started??" collapse into the same key.

Counter tallies each key, and examples keeps the first original wording so the output is readable.

Finally, the script prints every question that crossed the rule-of-3 threshold, most frequent first.

Running it

python faq_finder.py
Enter fullscreen mode Exit fullscreen mode

Example output:

Questions asked 3+ times (write a post for these):
5x  How do I get started?
3x  Is there a replay of the call?
Enter fullscreen mode Exit fullscreen mode

That's your writing list for the week.

Ideas to extend it

Lower the threshold to 2 if your volume is small.
Run it monthly with cron and email yourself the result.
Swap the word-set match for fuzzy matching (difflib.SequenceMatcher) to catch looser rewordings.
Add a column for the date and only count the last 30 days.

The workflow

  1. Run the script.
  2. Write one complete public answer for each repeat question.
  3. Pin them as a "Start here" FAQ.
  4. Reply to future DMs with the link.

Small script, big time savings, and your answers keep working after you've hit send.

I share automations like this with business owners and builders in the Automation Entrepreneur community: https://www.skool.com/automation-enterenpeur-7666

Top comments (0)