Initial commit of the Ad Generator Lite project, including backend services, frontend components, and configuration files. Added core functionalities for ad generation, user management, and image processing, along with a structured matrix system for ad testing.
f201243
| """ | |
| Hook Styles and Power Words - Language elements for compelling ad copy. | |
| """ | |
| from typing import Dict, Any, List, Optional | |
| import random | |
| HOOK_STYLES: Dict[str, Dict[str, Any]] = { | |
| "question": { | |
| "name": "Question Hook", | |
| "description": "Starts with a question to engage curiosity", | |
| "examples": ["What if you could save $500/year?", "Are you overpaying for insurance?", "Tired of high premiums?"], | |
| "trigger": "Curiosity", | |
| }, | |
| "statement": { | |
| "name": "Statement Hook", | |
| "description": "Bold declaration that demands attention", | |
| "examples": ["The secret to affordable insurance", "Most people don't know this trick", "The truth about insurance rates"], | |
| "trigger": "Curiosity", | |
| }, | |
| "number": { | |
| "name": "Number Hook", | |
| "description": "Uses specific numbers for credibility", | |
| "examples": ["3 ways to cut insurance costs", "Save $847 in 5 minutes", "97% of users see results"], | |
| "trigger": "Logic", | |
| }, | |
| "transformation": { | |
| "name": "Transformation Hook", | |
| "description": "Shows before/after change", | |
| "examples": ["From $200/month to $50/month", "Before: worried. After: protected.", "The change that saved everything"], | |
| "trigger": "Transformation", | |
| }, | |
| "urgency": { | |
| "name": "Urgency Hook", | |
| "description": "Creates time pressure", | |
| "examples": ["Limited time: Save 40% today", "Offer expires Friday", "Last chance for this rate"], | |
| "trigger": "FOMO", | |
| }, | |
| "notification": { | |
| "name": "Notification-Style Hook", | |
| "description": "Mimics system notifications", | |
| "examples": ["ALERT: Rates dropping now", "New message: Your savings are waiting", "Notice: Rate change detected"], | |
| "trigger": "Urgency", | |
| }, | |
| "curiosity_gap": { | |
| "name": "Curiosity Gap Hook", | |
| "description": "Creates information gap that needs closing", | |
| "examples": ["The reason your rates are so high", "What they don't want you to know", "The hidden trick insurance companies hate"], | |
| "trigger": "Curiosity", | |
| }, | |
| "pattern_interrupt": { | |
| "name": "Pattern Interrupt Hook", | |
| "description": "Breaks expected patterns to grab attention", | |
| "examples": ["Stop saving money (hear me out)", "I was wrong about insurance", "The worst advice that actually works"], | |
| "trigger": "Surprise", | |
| }, | |
| "social_proof": { | |
| "name": "Social Proof Hook", | |
| "description": "Leverages others' actions or opinions", | |
| "examples": ["Join 50,000+ satisfied customers", "Why thousands are switching", "Rated 5 stars by 10,000+ users"], | |
| "trigger": "Social Proof", | |
| }, | |
| "benefit": { | |
| "name": "Benefit-First Hook", | |
| "description": "Leads with the primary benefit", | |
| "examples": ["Save $500/year on home insurance", "Get coverage in 5 minutes", "Lower rates, better coverage"], | |
| "trigger": "Greed", | |
| }, | |
| "shocking_revelation": { | |
| "name": "Shocking Revelation Hook", | |
| "description": "Reveals surprising or shocking information", | |
| "examples": ["The insurance trick that saves you $1,000", "What insurance companies don't want you to know", "The hidden cost of cheap insurance"], | |
| "trigger": "Curiosity", | |
| }, | |
| "direct_command": { | |
| "name": "Direct Command Hook", | |
| "description": "Tells the reader exactly what to do", | |
| "examples": ["Stop overpaying today", "Get your quote now", "Compare rates in 60 seconds"], | |
| "trigger": "Action", | |
| }, | |
| "statistic_driven": { | |
| "name": "Statistic-Driven Hook", | |
| "description": "Uses compelling statistics to grab attention", | |
| "examples": ["9 out of 10 people overpay", "Save an average of $847 per year", "97% see results in 30 days"], | |
| "trigger": "Logic", | |
| }, | |
| "story_opener": { | |
| "name": "Story Opener Hook", | |
| "description": "Begins a narrative that draws the reader in", | |
| "examples": ["Last month, Sarah discovered something that changed everything", "Three years ago, I made a mistake that cost me thousands", "The day I found out I was overpaying..."], | |
| "trigger": "Curiosity", | |
| }, | |
| "contrarian_statement": { | |
| "name": "Contrarian Statement Hook", | |
| "description": "Challenges conventional wisdom", | |
| "examples": ["Everything you know about insurance is wrong", "The worst advice that actually works", "Why the popular choice is the wrong choice"], | |
| "trigger": "Curiosity", | |
| }, | |
| "empathy_first": { | |
| "name": "Empathy-First Hook", | |
| "description": "Shows understanding of the reader's situation", | |
| "examples": ["Tired of confusing insurance policies?", "Frustrated with rising rates?", "Wish insurance was simpler?"], | |
| "trigger": "Empathy", | |
| }, | |
| "exclusive_access": { | |
| "name": "Exclusive Access Hook", | |
| "description": "Offers special or limited access", | |
| "examples": ["Exclusive offer for new customers only", "VIP access to special rates", "Invitation-only pricing"], | |
| "trigger": "Exclusivity", | |
| }, | |
| } | |
| POWER_WORDS: Dict[str, List[str]] = { | |
| "urgency": ["Now", "Today", "Hurry", "Instant", "Fast", "Quick", "Limited", "Deadline", "Expires", "Final", "Last chance", "Act now"], | |
| "exclusivity": ["Exclusive", "Secret", "Hidden", "Private", "VIP", "Insider", "Confidential", "Elite", "Special", "Rare"], | |
| "savings": ["Free", "Save", "Discount", "Deal", "Bargain", "Value", "Affordable", "Bonus", "Extra", "Reward", "Cashback"], | |
| "trust": ["Guaranteed", "Proven", "Certified", "Verified", "Official", "Trusted", "Reliable", "Secure", "Safe", "Protected"], | |
| "transformation": ["Transform", "Change", "Unlock", "Discover", "Reveal", "Breakthrough", "Revolutionary", "New", "Improved", "Ultimate"], | |
| "emotion": ["Love", "Happy", "Joy", "Peace", "Confident", "Proud", "Relieved", "Excited", "Amazing", "Incredible"], | |
| "fear": ["Warning", "Danger", "Risk", "Threat", "Avoid", "Mistake", "Problem", "Crisis", "Emergency", "Alert"], | |
| "curiosity": ["Discover", "Learn", "Find out", "See why", "Uncover", "Secret", "Mystery", "Surprising", "Shocking", "Revealed"], | |
| "social_proof": ["Popular", "Trending", "Best-selling", "Top-rated", "Award-winning", "Recommended", "Thousands", "Millions", "Join"], | |
| "action": ["Get", "Start", "Try", "Claim", "Grab", "Take", "Join", "Sign up", "Subscribe", "Download", "Order", "Apply"], | |
| } | |
| CTA_TEMPLATES: Dict[str, List[str]] = { | |
| "action": ["Get Started", "Get Your Quote", "Start Saving", "Claim Your Discount", "See Your Rate", "Get Protected"], | |
| "urgency": ["Get It Now", "Claim Today", "Don't Miss Out", "Act Now", "Limited Time", "Last Chance"], | |
| "curiosity": ["Learn More", "See How", "Find Out", "Discover More", "See If You Qualify", "Check Eligibility"], | |
| "value": ["Save Now", "Get Free Quote", "Compare & Save", "See Your Savings", "Unlock Savings", "Get Best Rate"], | |
| "low_commitment": ["Try Free", "No Obligation", "See for Yourself", "Take a Look", "Explore Options", "Check It Out"], | |
| } | |
| def get_all_hook_styles() -> Dict[str, Dict[str, Any]]: | |
| return HOOK_STYLES | |
| def get_hook_style(key: str) -> Optional[Dict[str, Any]]: | |
| return HOOK_STYLES.get(key) | |
| def get_random_hook_style() -> Dict[str, Any]: | |
| key = random.choice(list(HOOK_STYLES.keys())) | |
| return {"key": key, **HOOK_STYLES[key]} | |
| def get_power_words(category: Optional[str] = None, count: int = 5) -> List[str]: | |
| if category and category in POWER_WORDS: | |
| words = POWER_WORDS[category] | |
| else: | |
| words = [w for cat_words in POWER_WORDS.values() for w in cat_words] | |
| return random.sample(words, min(count, len(words))) | |
| def get_random_cta(style: Optional[str] = None) -> str: | |
| if style and style in CTA_TEMPLATES: | |
| ctas = CTA_TEMPLATES[style] | |
| else: | |
| ctas = [c for style_ctas in CTA_TEMPLATES.values() for c in style_ctas] | |
| return random.choice(ctas) | |