Spaces:
Sleeping
Sleeping
File size: 1,626 Bytes
efdcedc | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | def optimize_copy(ad_text: str):
"""
Provides actionable suggestions to improve ad captions.
Rule-based, no training required.
"""
if not ad_text or len(ad_text.strip()) == 0:
return ["Ad text is empty, please provide text."]
suggestions = []
# Suggest shortening long captions
word_count = len(ad_text.split())
if word_count > 20:
suggestions.append("Consider shortening the caption (under 20 words).")
# Add urgency if missing
urgency_words = ["now", "today", "limited", "hurry", "exclusive", "offer"]
if not any(word in ad_text.lower() for word in urgency_words):
suggestions.append("Add urgency words like 'now', 'limited', 'exclusive'.")
# Check for punctuation / excitement
if "!" not in ad_text:
suggestions.append("Add punctuation or exclamation marks for excitement.")
# Suggest including a CTA if missing
cta_words = ["buy", "shop", "order", "download", "register", "sign up"]
if not any(word in ad_text.lower() for word in cta_words):
suggestions.append("Include a clear call-to-action (CTA) in your caption.")
# Suggest adding emotional trigger words
emotional_words = ["amazing", "best", "incredible", "free", "surprise"]
if not any(word in ad_text.lower() for word in emotional_words):
suggestions.append("Consider adding emotional trigger words to attract attention.")
# If no suggestions, compliment the copy
if len(suggestions) == 0:
suggestions.append("Your caption follows best practices!")
return suggestions
|