Generate Punny Word Combos in Python (Like Bipolar Bear)

I came across words like Bipolar bear and clandestination.

I wanted to generate more such punny (pun + funny) words. I took ChatGPT’s help.

I used this wordlist of top 10k common English words.

Some funny words from the output

  • accessingh
  • achievemental
  • acoustick
  • adjustmentor
  • afghanistanbul
  • airportfolio
  • anonymouse
  • benjamino
  • britannicaragua
  • broadbandwidth
  • brotherapist
  • capitaliano
  • characteristick
  • chocolatex
  • genevada
  • gothick

Cleaning script

Remove duplicates and words shorter than length 4.

def clean_wordlist(input_path, output_path, min_length=4):
    with open(input_path, 'r', encoding='utf-8') as infile:
        words = [w.strip().lower() for w in infile if len(w.strip()) >= min_length]
    words = sorted(set(words))  # Remove duplicates and sort

    with open(output_path, 'w', encoding='utf-8') as outfile:
        outfile.write('\n'.join(words))

    print(f"āœ… Saved {len(words)} words (≄{min_length} letters) to: {output_path}")

clean_wordlist("top10k.txt", "cleaned_wordlist.txt", min_length=4)

Word generation script

import time
import csv
from itertools import product

# Configuration
MIN_OVERLAP = 4
MIN_COMBO_LENGTH = 6
WORDLIST_PATH = "cleaned_wordlist.txt"
OUTPUT_CSV = "word_combos.csv"

def smart_overlap(w1, w2):
    w1 = w1.strip().lower()
    w2 = w2.strip().lower()
    max_overlap = min(len(w1), len(w2))

    for i in range(max_overlap, MIN_OVERLAP - 1, -1):
        if w1[-i:] == w2[:i]:
            combined = w1 + w2[i:]
            if combined != w1 and combined != w2 and len(combined) >= MIN_COMBO_LENGTH:
                return (combined, w1, w2, w1[-i:], i)
    return None

def write_csv_header(path):
    with open(path, 'w', newline='', encoding='utf-8') as f:
        writer = csv.writer(f)
        writer.writerow(['Combined Word', 'Word 1', 'Word 2', 'Overlap', 'Overlap Length'])

def append_to_csv(path, row):
    with open(path, 'a', newline='', encoding='utf-8') as f:
        writer = csv.writer(f)
        writer.writerow(row)

def generate_combos(wordlist_path, output_csv):
    with open(wordlist_path, 'r', encoding='utf-8') as f:
        words = [line.strip().lower() for line in f if line.strip()]

    total = len(words) ** 2
    seen = set()
    start_time = time.time()

    write_csv_header(output_csv)

    for idx, (w1, w2) in enumerate(product(words, repeat=2), 1):
        if w1 == w2:
            continue

        result = smart_overlap(w1, w2)
        if result and result[0] not in seen:
            seen.add(result[0])
            append_to_csv(output_csv, result)

        # Progress logging
        if idx % 10000 == 0 or idx == total:
            elapsed = time.time() - start_time
            speed = idx / elapsed
            remaining = (total - idx) / speed if speed else 0
            print(f"Processed: {idx}/{total} | Found: {len(seen)} | "
                  f"Elapsed: {int(elapsed)}s | ETA: {int(remaining)}s")

    print(f"\nāœ… Done! Saved {len(seen)} combos to {output_csv}")

if __name__ == "__main__":
    generate_combos(WORDLIST_PATH, OUTPUT_CSV)

I guess I am a vibe coder now. Haha!

All words

Caution: There might be some offensive words in it. The list has not been checked manually.