Coverage for integrations / marketing / marketing_nunban.py: 0.0%
58 statements
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-12 04:49 +0000
« prev ^ index » next coverage.py v7.14.0, created at 2026-05-12 04:49 +0000
1"""
2Marketing Nunban — Tamil-Rooted, Globally Adaptive Marketing Intelligence.
4"Yaadhum Oore Yaavarum Kelir"
5(Every place is our hometown, every person is our kin)
6— Kaniyan Pungundranar, Sangam Literature (~300 BCE)
8This is Nunba's marketing philosophy. Honest. Tamil by default. Universal by nature.
10The marketing agent uses:
11 - Thirukkural couplets as the foundation (2000+ years of Tamil ethical wisdom)
12 - cultural_wisdom.py traits for geographic adaptation
13 - No dark patterns, no manipulation, no hype — just truth
14"""
16from cultural_wisdom import CULTURAL_TRAITS, get_trait_by_name
19# ═══════════════════════════════════════════════════════════════════════
20# Thirukkural Wisdom — Selected couplets for marketing contexts
21# ═══════════════════════════════════════════════════════════════════════
23THIRUKKURAL = {
24 # Aram (Virtue/Righteousness)
25 'truth': {
26 'tamil': 'எப்பொருள் யார்யார்வாய்க் கேட்பினும் அப்பொருள் மெய்ப்பொருள் காண்ப தறிவு',
27 'transliteration': 'Epporul yaaryaarvaayk ketpinum apporul meyporul kaanpa tharivu',
28 'meaning': 'True wisdom is seeing the truth in what anyone says, regardless of who they are',
29 'kural_number': 423,
30 'marketing_use': 'opening_honest_claims',
31 },
32 'hospitality': {
33 'tamil': 'இருந்தோம்பி இல்வாழ்வ தெல்லாம் விருந்தோம்பி வேளாண்மை செய்தற் பொருட்டு',
34 'transliteration': 'Irunthombi ilvaazhva thellaam virunthombi velaanmai seydhar poruttu',
35 'meaning': 'The purpose of earning and saving is to serve guests with hospitality',
36 'kural_number': 81,
37 'marketing_use': 'welcoming_new_users',
38 },
39 'non_harm': {
40 'tamil': 'இன்னா செய்யாமை மாசற்றார் கோள்',
41 'transliteration': 'Innaa seyyaamai maasatraar kol',
42 'meaning': 'The principle of the pure-hearted is to never cause harm',
43 'kural_number': 311,
44 'marketing_use': 'no_dark_patterns_pledge',
45 },
46 'sweet_words': {
47 'tamil': 'இனிய உளவாக இன்னாத கூறல் கனியிருப்பக் காய்கவர்ந் தற்று',
48 'transliteration': 'Iniya ulavaaga innaatha kooral kaniyiruppak kaaykavarn thatru',
49 'meaning': 'Speaking harsh words when kind ones are available is like choosing unripe fruit when ripe ones exist',
50 'kural_number': 100,
51 'marketing_use': 'tone_of_communication',
52 },
53 'reputation': {
54 'tamil': 'ஒழுக்கம் விழுப்பம் தரலான் ஒழுக்கம் உயிரினும் ஓம்பப் படும்',
55 'transliteration': 'Ozhukkam vizhuppam tharalaan ozhukkam uyirinum ombap padum',
56 'meaning': 'Good conduct brings honor; it must be guarded more carefully than life itself',
57 'kural_number': 131,
58 'marketing_use': 'brand_integrity',
59 },
60 # Porul (Wealth/Strategy)
61 'right_action': {
62 'tamil': 'செய்க பொருளை செறுநர் செருக்கறுக்கும் எஃகதனிற் கூரிய தில்',
63 'transliteration': 'Seyka porulai serunar serukkurukkum eqkathanir kooriya thil',
64 'meaning': 'Earn wealth — there is no sharper weapon against those who despise you',
65 'kural_number': 759,
66 'marketing_use': 'value_creation',
67 },
68 'knowing_audience': {
69 'tamil': 'அறிவுடையார் எல்லாம் உடையார் அறிவிலார் என்னுடைய ரேனும் இலர்',
70 'transliteration': 'Arivudaiyaar ellaam udaiyaar arivilaar ennudaiya renum ilar',
71 'meaning': 'Those with wisdom have everything; those without it have nothing, regardless of what they possess',
72 'kural_number': 430,
73 'marketing_use': 'educational_marketing',
74 },
75 # Inbam (Love/Joy)
76 'love': {
77 'tamil': 'அன்பிலார் எல்லாம் தமக்குரியர் அன்புடையார் என்பும் உரியர் பிறர்க்கு',
78 'transliteration': 'Anpilaar ellaam thamakkuriyar anbudaiyaar enbum uriyar pirakku',
79 'meaning': 'The loveless keep everything for themselves; the loving give even their bones to others',
80 'kural_number': 72,
81 'marketing_use': 'generosity_messaging',
82 },
83 'universal_kinship': {
84 'tamil': 'யாதும் ஊரே யாவரும் கேளிர்',
85 'transliteration': 'Yaadhum Oore Yaavarum Kelir',
86 'meaning': 'Every place is our hometown, every person is our kin',
87 'kural_number': 0, # Sangam literature, not Kural — Pura Nanuru 192
88 'marketing_use': 'global_brand_philosophy',
89 },
90}
92# Tamil proverbs for marketing contexts
93TAMIL_PROVERBS = {
94 'trust': {
95 'tamil': 'நம்பிக்கை இல்லாத இடத்தில் நட்பு இல்லை',
96 'meaning': 'Where there is no trust, there is no friendship',
97 'use': 'trust_building',
98 },
99 'patience': {
100 'tamil': 'பொறுமை கடலையும் கடக்கும்',
101 'meaning': 'Patience can cross even the ocean',
102 'use': 'long_term_growth',
103 },
104 'honesty': {
105 'tamil': 'வாய்மையே வெல்லும்',
106 'meaning': 'Truth alone triumphs',
107 'use': 'honest_marketing_pledge',
108 },
109 'community': {
110 'tamil': 'ஒற்றுமையே பலம்',
111 'meaning': 'Unity is strength',
112 'use': 'community_building',
113 },
114 'action': {
115 'tamil': 'கற்றது கைமண் அளவு, கல்லாதது உலகளவு',
116 'meaning': 'What you have learned is a handful of sand; what you haven\'t learned is the whole world',
117 'use': 'humility_and_learning',
118 },
119 'generosity': {
120 'tamil': 'கொடுப்பதும் ஒரு வகை தர்மம், கேட்பதும் ஒரு வகை தர்மம்',
121 'meaning': 'Giving is one form of dharma, asking is another',
122 'use': 'mutual_value',
123 },
124}
127# ═══════════════════════════════════════════════════════════════════════
128# Geographic Cultural Adaptation
129# ═══════════════════════════════════════════════════════════════════════
131GEOGRAPHIC_STYLES = {
132 'tamil_nadu': {
133 'language': 'Tamil',
134 'tone': 'warm, poetic, family-oriented, Thirukkural-grounded',
135 'greeting': 'வணக்கம் (Vanakkam)',
136 'values': ['hospitality', 'truth', 'family', 'education', 'resilience'],
137 'cultural_traits': ['Atithi Devo Bhava', 'Seva', 'Jugaad'],
138 'avoid': ['condescension', 'assuming rural = uneducated'],
139 'note': 'DEFAULT voice. All other styles adapt FROM this, not TO this.',
140 },
141 'south_asia': {
142 'language': 'Hindi/English/regional mix',
143 'tone': 'direct warmth, community-oriented, respectful of elders',
144 'greeting': 'Namaste / Vanakkam / Sat Sri Akaal',
145 'values': ['family', 'education', 'community', 'aspiration'],
146 'cultural_traits': ['Atithi Devo Bhava', 'Seva', 'Jugaad', 'Ahimsa'],
147 'avoid': ['stereotyping', 'one-size-fits-all for 1.4B people'],
148 'note': 'India is 28 states, each with distinct culture. Ask, don\'t assume.',
149 },
150 'east_asia': {
151 'language': 'context-dependent',
152 'tone': 'subtle, respectful, quality-focused, no hard-sell',
153 'greeting': 'context-dependent greeting',
154 'values': ['harmony', 'quality', 'respect', 'aesthetics', 'mastery'],
155 'cultural_traits': ['Ikigai', 'Wabi-sabi', 'Kintsugi', 'Mottainai', 'Tao', 'Ren'],
156 'avoid': ['loud marketing', 'overselling', 'rushing'],
157 'note': 'Value speaks louder than claims. Show, don\'t tell.',
158 },
159 'southeast_asia': {
160 'language': 'local language + English',
161 'tone': 'friendly, respectful, community-focused',
162 'greeting': 'Sawadee / Xin chào / Selamat',
163 'values': ['community', 'harmony', 'respect', 'spirituality'],
164 'cultural_traits': ['Ubuntu', 'Aloha', 'Seva'],
165 'avoid': ['aggressive tone', 'individualism-centric messaging'],
166 'note': 'Relationship-first cultures. Build rapport before business.',
167 },
168 'middle_east': {
169 'language': 'Arabic/local + English',
170 'tone': 'hospitable, respectful, eloquent, generous',
171 'greeting': 'As-salamu alaykum / Marhaba',
172 'values': ['hospitality', 'honor', 'generosity', 'family', 'education'],
173 'cultural_traits': ['Tarab', 'Atithi Devo Bhava', 'Filoxenia'],
174 'avoid': ['religious insensitivity', 'cultural assumptions'],
175 'note': 'Hospitality is deeply valued. Be generous with time and attention.',
176 },
177 'africa': {
178 'language': 'local language + English/French/Portuguese',
179 'tone': 'communal, warm, storytelling-rich, empowering',
180 'greeting': 'Sawubona / Jambo / Sanibonani',
181 'values': ['community', 'resilience', 'storytelling', 'Ubuntu', 'innovation'],
182 'cultural_traits': ['Ubuntu', 'Sawubona', 'Sankofa'],
183 'avoid': ['poverty narratives', 'savior complex', 'monolithic view of 54 countries'],
184 'note': 'Africa is the most linguistically diverse continent. Ask which culture, don\'t assume.',
185 },
186 'northern_europe': {
187 'language': 'local + English',
188 'tone': 'functional, honest, understated, no-hype',
189 'greeting': 'Hej / Hei / Moi',
190 'values': ['equality', 'sustainability', 'function over form', 'trust'],
191 'cultural_traits': ['Hygge', 'Sisu', 'Lagom', 'Friluftsliv'],
192 'avoid': ['superlatives', 'hype', 'aggressive sales'],
193 'note': 'Lagom is king. Say less. Mean more. Deliver on promises.',
194 },
195 'southern_europe': {
196 'language': 'local + English',
197 'tone': 'warm, conversational, passionate but genuine, artistic',
198 'greeting': 'Ciao / Hola / Olá / Yassou',
199 'values': ['beauty', 'conversation', 'family', 'food', 'art'],
200 'cultural_traits': ['Meraki', 'Filoxenia', 'Sprezzatura', 'Tertúlia', 'Kefi'],
201 'avoid': ['cold/corporate tone', 'transactional language'],
202 'note': 'Conversation IS the relationship. Don\'t rush to the pitch.',
203 },
204 'north_america': {
205 'language': 'English/Spanish/French',
206 'tone': 'clear, value-driven, proof-oriented, but warm',
207 'greeting': 'Hey / Hello / Hola',
208 'values': ['innovation', 'individual empowerment', 'diversity', 'authenticity'],
209 'cultural_traits': ['Mitakuye Oyasin', 'Sisu', 'Meraki'],
210 'avoid': ['generic AI hype', 'overclaiming', 'ignoring diversity'],
211 'note': 'People are skeptical of AI claims. Lead with proof and honest limitations.',
212 },
213 'latin_america': {
214 'language': 'Spanish/Portuguese + local languages',
215 'tone': 'warm, passionate, family-oriented, community-driven',
216 'greeting': 'Hola / Olá / Buenos días',
217 'values': ['family', 'community', 'joy', 'resilience', 'music'],
218 'cultural_traits': ['Tertúlia', 'In Lak\'ech', 'Sumak Kawsay', 'Merak'],
219 'avoid': ['monolithic view of 20+ countries', 'ignoring indigenous cultures'],
220 'note': 'Sumak Kawsay (Buen Vivir) aligns perfectly with Nunba\'s philosophy.',
221 },
222 'oceania': {
223 'language': 'English + indigenous languages',
224 'tone': 'genuine, nature-connected, respectful of First Nations',
225 'greeting': 'G\'day / Kia ora / Bula',
226 'values': ['nature', 'community', 'deep listening', 'stories'],
227 'cultural_traits': ['Dadirri', 'Mana', 'Aloha'],
228 'avoid': ['ignoring indigenous perspectives', 'colonial language'],
229 'note': 'Dadirri — deep listening — is the most powerful marketing tool here.',
230 },
231}
234# ═══════════════════════════════════════════════════════════════════════
235# Marketing Prompt Builders
236# ═══════════════════════════════════════════════════════════════════════
238def get_marketing_system_prompt(geography: str = 'tamil_nadu') -> str:
239 """Build the marketing agent's system prompt, adapted for geography.
241 Args:
242 geography: Key from GEOGRAPHIC_STYLES. Defaults to 'tamil_nadu'.
243 """
244 style = GEOGRAPHIC_STYLES.get(geography, GEOGRAPHIC_STYLES['tamil_nadu'])
245 kural = THIRUKKURAL['universal_kinship']
247 prompt = f"""You are Nunban — Nunba's marketing guardian. Your name means "one of Nunba" in Tamil.
249CORE PHILOSOPHY (from Sangam literature, ~300 BCE):
250"{kural['tamil']}"
251"{kural['transliteration']}"
252"{kural['meaning']}"
254You market Nunba HONESTLY. You are rooted in Tamil cultural values:
255- Mei (மெய்) — Truth: Never exaggerate what Nunba can do
256- Aram (அறம்) — Righteousness: Never use dark patterns or manipulation
257- Anbu (அன்பு) — Love: Genuine care for every person you speak with
258- Virunthombal (விருந்தோம்பல்) — Hospitality: Welcome everyone warmly
260CURRENT AUDIENCE ADAPTATION:
261- Region: {geography}
262- Tone: {style['tone']}
263- Values they resonate with: {', '.join(style['values'])}
264- Cultural traits to embody: {', '.join(style['cultural_traits'])}
265- Things to AVOID: {', '.join(style['avoid'])}
266- Note: {style['note']}
268MARKETING RULES (non-negotiable):
2691. Never lie about what Nunba can or cannot do
2702. Never use dark patterns, urgency tricks, or FOMO manipulation
2713. If Nunba can't help someone, say so and suggest alternatives
2724. Every interaction should leave the person better off — even if they don't use Nunba
2735. Measure success by trust earned, not clicks generated
2746. Healthy disengagement is a feature — don't optimize for addiction
2757. Start with a relevant Thirukkural couplet or Tamil proverb when appropriate
2768. Adapt language and cultural references to the person's geography
2779. Remember: the Tamil values of truth, hospitality, and love are UNIVERSAL
27810. "Yaadhum Oore Yaavarum Kelir" — every person is kin, every place is home
279"""
280 return prompt
283def get_kural_for_context(context: str) -> dict | None:
284 """Get a relevant Thirukkural couplet for a marketing context.
286 Args:
287 context: One of 'welcoming_new_users', 'honest_claims', 'trust_building',
288 'brand_integrity', 'value_creation', 'educational_marketing',
289 'generosity_messaging', 'global_brand_philosophy', etc.
290 """
291 for key, kural in THIRUKKURAL.items():
292 if kural.get('marketing_use') == context:
293 return kural
294 return THIRUKKURAL.get('universal_kinship')
297def get_proverb_for_context(context: str) -> dict | None:
298 """Get a relevant Tamil proverb for a marketing context."""
299 for key, proverb in TAMIL_PROVERBS.items():
300 if proverb.get('use') == context:
301 return proverb
302 return TAMIL_PROVERBS.get('honesty')
305def detect_geography(user_data: dict) -> str:
306 """Detect the best geographic style based on user data.
308 Looks at preferred_language, timezone, location, and interaction history.
309 Returns a key from GEOGRAPHIC_STYLES.
310 """
311 lang = (user_data.get('preferred_language') or '').lower()
312 location = (user_data.get('location') or '').lower()
313 timezone = (user_data.get('timezone') or '').lower()
315 # Tamil detection
316 if any(x in lang for x in ['tamil', 'tamizh', 'ta']):
317 return 'tamil_nadu'
318 if any(x in location for x in ['tamil nadu', 'chennai', 'madurai', 'coimbatore']):
319 return 'tamil_nadu'
321 # South Asian
322 if any(x in lang for x in ['hindi', 'bengali', 'telugu', 'kannada', 'malayalam', 'marathi', 'gujarati', 'punjabi', 'urdu']):
323 return 'south_asia'
324 if any(x in location for x in ['india', 'pakistan', 'bangladesh', 'sri lanka', 'nepal']):
325 return 'south_asia'
327 # East Asian
328 if any(x in lang for x in ['japanese', 'chinese', 'korean', 'mandarin']):
329 return 'east_asia'
330 if any(x in location for x in ['japan', 'china', 'korea', 'taiwan']):
331 return 'east_asia'
333 # Arabic / Middle East
334 if any(x in lang for x in ['arabic', 'farsi', 'persian', 'hebrew', 'turkish']):
335 return 'middle_east'
337 # African
338 if any(x in lang for x in ['swahili', 'yoruba', 'igbo', 'zulu', 'amharic', 'hausa']):
339 return 'africa'
341 # Northern Europe
342 if any(x in lang for x in ['swedish', 'norwegian', 'danish', 'finnish', 'dutch', 'german']):
343 return 'northern_europe'
345 # Southern Europe
346 if any(x in lang for x in ['italian', 'spanish', 'portuguese', 'greek']):
347 return 'southern_europe'
348 if any(x in location for x in ['italy', 'spain', 'portugal', 'greece']):
349 return 'southern_europe'
351 # Latin America
352 if any(x in location for x in ['mexico', 'brazil', 'argentina', 'colombia', 'peru', 'chile']):
353 return 'latin_america'
355 # Oceania
356 if any(x in location for x in ['australia', 'new zealand', 'fiji', 'samoa']):
357 return 'oceania'
359 # Southeast Asia
360 if any(x in lang for x in ['thai', 'vietnamese', 'malay', 'indonesian', 'tagalog']):
361 return 'southeast_asia'
363 # North America (default for English without other signals)
364 if any(x in lang for x in ['english']):
365 if any(x in timezone for x in ['america', 'us/', 'canada']):
366 return 'north_america'
368 # Default: Tamil Nadu (Tamil culture is the foundation)
369 return 'tamil_nadu'
372def get_all_regions() -> list:
373 """Return all available geographic regions."""
374 return list(GEOGRAPHIC_STYLES.keys())
377def get_style_for_region(region: str) -> dict:
378 """Get the communication style for a specific region."""
379 return GEOGRAPHIC_STYLES.get(region, GEOGRAPHIC_STYLES['tamil_nadu'])