Stanley03 commited on
Commit
de6a6a6
Β·
verified Β·
1 Parent(s): baaa104

Create knowledgebase.py

Browse files
Files changed (1) hide show
  1. knowledgebase.py +542 -0
knowledgebase.py ADDED
@@ -0,0 +1,542 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ STANLEY AI - Kiswahili Knowledge Base
3
+ Advanced cultural and linguistic database for enhanced AI responses
4
+ """
5
+
6
+ class KiswahiliKnowledgeBase:
7
+ def __init__(self):
8
+ self.kiswahili_data = self._initialize_kiswahili_data()
9
+ self.cultural_context = self._initialize_cultural_context()
10
+ self.lion_king_lore = self._initialize_lion_king_lore()
11
+ self.advanced_phrases = self._initialize_advanced_phrases()
12
+
13
+ def _initialize_kiswahili_data(self):
14
+ """Comprehensive Kiswahili vocabulary and grammar"""
15
+ return {
16
+ "greetings": {
17
+ "formal": {
18
+ "Shikamoo": "Greeting to elders (response: Marahaba)",
19
+ "Marahaba": "Response to Shikamoo",
20
+ "Habari za asubuhi": "Good morning news",
21
+ "Habari za mchana": "Good afternoon news",
22
+ "Habari za jioni": "Good evening news",
23
+ "Habari gani?": "What news? (How are you?)"
24
+ },
25
+ "informal": {
26
+ "Mambo": "What's up? (response: Poa)",
27
+ "Poa": "Cool (response to Mambo)",
28
+ "Vipi?": "How? What's up?",
29
+ "Sema": "Speak (greeting)",
30
+ "Niaje": "How's it going?"
31
+ },
32
+ "responses": {
33
+ "Nzuri": "Good",
34
+ "Safi": "Clean/Cool",
35
+ "Salama": "Peaceful",
36
+ "Poa kichizi kama ndizi": "Cool crazy like a banana",
37
+ "Freshi": "Fresh"
38
+ }
39
+ },
40
+
41
+ "common_phrases": {
42
+ "courtesy": {
43
+ "Asante": "Thank you",
44
+ "Asante sana": "Thank you very much",
45
+ "Tafadhali": "Please",
46
+ "Samahani": "Sorry/Excuse me",
47
+ "Pole": "Sorry (for misfortune)",
48
+ "Pole sana": "Very sorry",
49
+ "Karibu": "You're welcome",
50
+ "Karibu sana": "You're very welcome",
51
+ "Starehe": "Make yourself comfortable"
52
+ },
53
+ "essential": {
54
+ "Ndio": "Yes",
55
+ "Hapana": "No",
56
+ "Sawa": "Okay",
57
+ "Labda": "Maybe",
58
+ "Bila shaka": "Without doubt",
59
+ "Hamna shida": "No problem",
60
+ "Hakuna matata": "No worries",
61
+ "Hakuna wasiwasi": "No worries (more formal)"
62
+ }
63
+ },
64
+
65
+ "lion_king_vocabulary": {
66
+ "characters": {
67
+ "Simba": "Lion",
68
+ "Nala": "Gift",
69
+ "Rafiki": "Friend",
70
+ "Mufasa": "King",
71
+ "Sarabi": "Mirage",
72
+ "Sarafina": "Bright star",
73
+ "Pumbaa": "Simpleton/Be careless",
74
+ "Timon": "Respect",
75
+ "Shenzi": "Barbarian/Uncouth",
76
+ "Banzai": "Skulk/Move stealthily",
77
+ "Ed": "Short for Edward (no Swahili meaning)"
78
+ },
79
+ "locations": {
80
+ "Pride Rock": "Mwamba wa Pride",
81
+ "Elephant Graveyard": "Makaburi ya Tembo",
82
+ "Watering Hole": "Kisima cha Maji",
83
+ "Jungle": "Msitu",
84
+ "Savannah": "Nyika"
85
+ },
86
+ "concepts": {
87
+ "Circle of Life": "Mduara wa Uhai",
88
+ "King": "Mfalme",
89
+ "Queen": "Malkia",
90
+ "Prince": "Mwana Mfalme",
91
+ "Pride": "Fahari/Majivuno",
92
+ "Hunt": "Windla",
93
+ "Roar": "Koroma"
94
+ }
95
+ },
96
+
97
+ "grammar_essentials": {
98
+ "noun_classes": {
99
+ "M-/WA-": "People (mtu - person, watu - people)",
100
+ "M-/MI-": "Plants, natural things (mti - tree, miti - trees)",
101
+ "JI-/MA-": "Fruits, foreign objects (tunda - fruit, matunda - fruits)",
102
+ "KI-/VI-": "Tools, languages (kiti - chair, viti - chairs)",
103
+ "N-": "Animals, things (ndege - bird/birds)",
104
+ "U-": "Abstract, mass nouns (ugonjwa - disease)",
105
+ "KU-": "Verbal nouns (kusoma - to read)",
106
+ "PA-": "Locatives (mahali - place)",
107
+ "MU-": "Locatives (ndani - inside)",
108
+ "KU-": "Locatives (kule - there)"
109
+ },
110
+ "verb_tenses": {
111
+ "present": "Na- (ninasoma - I am reading)",
112
+ "past": "Li- (nilisoma - I read)",
113
+ "future": "Ta- (nitasoma - I will read)",
114
+ "perfect": "Me- (nimesoma - I have read)",
115
+ "habitual": "Hu- (ninasoma - I usually read)"
116
+ }
117
+ },
118
+
119
+ "numbers": {
120
+ "1": "Moja", "2": "Mbili", "3": "Tatu", "4": "Nne", "5": "Tano",
121
+ "6": "Sita", "7": "Saba", "8": "Nane", "9": "Tisa", "10": "Kumi",
122
+ "20": "Ishirini", "30": "Thelathini", "40": "Arobaini",
123
+ "50": "Hamsini", "100": "Mia moja", "1000": "Elfu moja"
124
+ },
125
+
126
+ "time_expressions": {
127
+ "days": {
128
+ "Leo": "Today",
129
+ "Kesho": "Tomorrow",
130
+ "Jana": "Yesterday",
131
+ "Jumanne": "Tuesday",
132
+ "Jumatatu": "Monday",
133
+ "Jumatano": "Wednesday",
134
+ "Alhamisi": "Thursday",
135
+ "Ijumaa": "Friday",
136
+ "Jumamosi": "Saturday",
137
+ "Jumapili": "Sunday"
138
+ },
139
+ "time": {
140
+ "Sasa hivi": "Right now",
141
+ "Baadaye": "Later",
142
+ "Mara moja": "Immediately",
143
+ "Asubuhi": "Morning",
144
+ "Mchana": "Afternoon",
145
+ "Jioni": "Evening",
146
+ "Usiku": "Night",
147
+ "Saa ngapi?": "What time?"
148
+ }
149
+ }
150
+ }
151
+
152
+ def _initialize_cultural_context(self):
153
+ """East African cultural knowledge and context"""
154
+ return {
155
+ "cultural_concepts": {
156
+ "ujamaa": "Familyhood/Socialism - Community cooperation",
157
+ "harambee": "Pull together - Community self-help",
158
+ "ubuntu": "Humanity towards others - I am because we are",
159
+ "pole_pole": "Slowly slowly - Take your time, be careful",
160
+ "mwalimu": "Teacher - Respect for educators",
161
+ "mzee": "Elder - Respect for older people",
162
+ "dunia": "The world - Global perspective",
163
+ "imani": "Faith/Belief - Trust and confidence"
164
+ },
165
+
166
+ "traditional_values": {
167
+ "respect_for_elders": "Elders are highly respected in Swahili culture",
168
+ "community_first": "Community needs come before individual desires",
169
+ "hospitality": "Guests are treated with great honor (karibu)",
170
+ "indirect_communication": "Often prefer indirectness to avoid conflict",
171
+ "time_flexibility": "African time' - more relaxed about punctuality",
172
+ "oral_tradition": "Strong tradition of storytelling and proverbs"
173
+ },
174
+
175
+ "swahili_proverbs": {
176
+ "Mgeni siku mbili; siku ya tatu mpe jembe": "A guest for two days; on the third day give him a hoe",
177
+ "Haraka haraka haina baraka": "Hurry hurry has no blessing",
178
+ "Asiyefunzwa na mamae hufunzwa na ulimwengu": "He who is not taught by his mother will be taught by the world",
179
+ "Mwacha mila ni mtumwa": "He who abandons his culture is a slave",
180
+ "Pole pole ndio mwendo": "Slowly slowly is the way to go",
181
+ "Fimbo ya mbali haiui nyoka": "A stick from far away doesn't kill a snake",
182
+ "Mwenye pupa hadiriki kula tamu": "The hurried person doesn't get to eat sweets"
183
+ },
184
+
185
+ "food_culture": {
186
+ "staple_foods": {
187
+ "ugali": "Maize porridge - the main staple",
188
+ "wali": "Rice",
189
+ "nyama_choma": "Grilled meat",
190
+ "sukuma_wiki": "Collard greens - 'push the week'",
191
+ "kachumbari": "Tomato and onion salad",
192
+ "pilau": "Spiced rice dish",
193
+ "chapati": "Flatbread",
194
+ "mandazi": "Swahili donuts"
195
+ },
196
+ "beverages": {
197
+ "chai": "Tea (usually spiced)",
198
+ "kahawa": "Coffee",
199
+ "maji": "Water",
200
+ "uji": "Porridge",
201
+ "madafu": "Coconut water"
202
+ }
203
+ }
204
+ }
205
+
206
+ def _initialize_lion_king_lore(self):
207
+ """Comprehensive Lion King story and character knowledge"""
208
+ return {
209
+ "character_backstories": {
210
+ "simba": {
211
+ "name_meaning": "Lion",
212
+ "birth": "Born to Mufasa and Sarabi at Pride Rock",
213
+ "personality": "Playful, brave, initially naive but grows wise",
214
+ "journey": "Exiled after Mufasa's death, raised by Timon and Pumbaa",
215
+ "transformation": "Returns to reclaim his kingdom after Rafiki's guidance",
216
+ "key_phrases": ["Hakuna Matata", "I just can't wait to be king"]
217
+ },
218
+ "nala": {
219
+ "name_meaning": "Gift",
220
+ "role": "Simba's childhood friend and future queen",
221
+ "personality": "Brave, independent, strong-willed",
222
+ "journey": "Leaves Pride Lands to find help, reunites with Simba",
223
+ "significance": "Convinces Simba to return and claim his destiny"
224
+ },
225
+ "mufasa": {
226
+ "name_meaning": "King",
227
+ "role": "Wise and noble king of Pride Rock",
228
+ "philosophy": "Believes in the Circle of Life",
229
+ "death": "Killed by Scar in the wildebeest stampede",
230
+ "legacy": "Appears as a spirit to guide Simba"
231
+ },
232
+ "rafiki": {
233
+ "name_meaning": "Friend",
234
+ "role": "Mystical baboon shaman and advisor",
235
+ "abilities": "Spiritual wisdom, connection to ancestors",
236
+ "key_scenes": ["Presenting Simba, guiding adult Simba"],
237
+ "famous_line": "The past can hurt. But the way I see it, you can either run from it, or learn from it."
238
+ }
239
+ },
240
+
241
+ "story_arcs": {
242
+ "circle_of_life": {
243
+ "concept": "The delicate balance connecting all living things",
244
+ "representation": "Shown through the ecosystem of Pride Lands",
245
+ "mufasa_explanation": "We are all connected in the great Circle of Life",
246
+ "violation": "Scar's rule disrupts the balance",
247
+ "restoration": "Simba's return restores harmony"
248
+ },
249
+ "hakuna_matata_philosophy": {
250
+ "meaning": "No worries - problem-free philosophy",
251
+ "origin": "Taught to Simba by Timon and Pumbaa",
252
+ "purpose": "Helps Simba cope with trauma and guilt",
253
+ "limitation": "Avoidance rather than confrontation",
254
+ "growth": "Simba learns to face problems rather than ignore them"
255
+ },
256
+ "redemption_journey": {
257
+ "exile": "Simba runs away believing he caused Mufasa's death",
258
+ "carefree_life": "Lives with Timon and Pumbaa practicing Hakuna Matata",
259
+ "awakening": "Nala's arrival and Rafiki's guidance",
260
+ "confrontation": "Faces Scar and the truth about Mufasa's death",
261
+ "restoration": "Defeats Scar and restores the kingdom"
262
+ }
263
+ },
264
+
265
+ "cultural_influences": {
266
+ "swahili_language": "Character names and phrases throughout",
267
+ "african_landscapes": "Based on Kenyan and Tanzanian savannahs",
268
+ "masai_influence": "Pride Lands inspired by Maasai Mara",
269
+ "african_philosophy": "Ubuntu and community values",
270
+ "animal_symbolism": "Traditional African animal representations"
271
+ }
272
+ }
273
+
274
+ def _initialize_advanced_phrases(self):
275
+ """Advanced Kiswahili for sophisticated conversations"""
276
+ return {
277
+ "philosophical_concepts": {
278
+ "Umoja": "Unity - First day of Kwanzaa",
279
+ "Kujichagulia": "Self-determination - Second day of Kwanzaa",
280
+ "Ujima": "Collective work and responsibility - Third day of Kwanzaa",
281
+ "Ujamaa": "Cooperative economics - Fourth day of Kwanzaa",
282
+ "Nia": "Purpose - Fifth day of Kwanzaa",
283
+ "Kuumba": "Creativity - Sixth day of Kwanzaa",
284
+ "Imani": "Faith - Seventh day of Kwanzaa"
285
+ },
286
+
287
+ "poetic_expressions": {
288
+ "Moyo wangu unaimba": "My heart is singing",
289
+ "Upepo wa upendo": "The wind of love",
290
+ "Nyota za bahati": "Stars of luck",
291
+ "Mstari wa hatima": "The line of destiny",
292
+ "Sauti ya amani": "The voice of peace"
293
+ },
294
+
295
+ "business_phrases": {
296
+ "Biashara": "Business",
297
+ "Mkataba": "Contract",
298
+ "Mapato": "Income",
299
+ "Gharama": "Cost",
300
+ "Faida": "Profit",
301
+ "Hasara": "Loss",
302
+ "Soko": "Market",
303
+ "Bei": "Price",
304
+ "Bei ya chini": "Lowest price",
305
+ "Tafadhali punguza bei": "Please reduce the price"
306
+ },
307
+
308
+ "medical_terms": {
309
+ "Daktari": "Doctor",
310
+ "Hospitali": "Hospital",
311
+ "Maumivu": "Pain",
312
+ "Dawa": "Medicine",
313
+ "Kuhara": "Diarrhea",
314
+ "Kichwa kinaniuma": "My head hurts",
315
+ "Mguu unaniuma": "My leg hurts",
316
+ "Nina homa": "I have fever"
317
+ },
318
+
319
+ "travel_phrases": {
320
+ "Ninaenda wapi?": "Where am I going?",
321
+ "Ninahitaji teksi": "I need a taxi",
322
+ "Bei gani?": "How much?",
323
+ "Ninaenda hotelini": "I'm going to the hotel",
324
+ "Ninaitwa...": "My name is...",
325
+ "Siwezi kuzungumza Kiswahili vizuri": "I can't speak Swahili well",
326
+ "Unaweza kusema polepole?": "Can you speak slowly?",
327
+ "Tafadhali nisaidie": "Please help me"
328
+ }
329
+ }
330
+
331
+ def get_kiswahili_phrase(self, category, subcategory=None, phrase=None):
332
+ """Retrieve specific Kiswahili phrases"""
333
+ if subcategory and phrase:
334
+ return self.kiswahili_data.get(category, {}).get(subcategory, {}).get(phrase)
335
+ elif subcategory:
336
+ return self.kiswahili_data.get(category, {}).get(subcategory, {})
337
+ else:
338
+ return self.kiswahili_data.get(category, {})
339
+
340
+ def get_cultural_insight(self, concept):
341
+ """Get cultural context for concepts"""
342
+ return self.cultural_context.get('cultural_concepts', {}).get(concept)
343
+
344
+ def get_lion_king_character(self, character):
345
+ """Get detailed Lion King character information"""
346
+ return self.lion_king_lore.get('character_backstories', {}).get(character.lower())
347
+
348
+ def get_random_proverb(self):
349
+ """Get a random Swahili proverb"""
350
+ import random
351
+ proverbs = self.cultural_context.get('swahili_proverbs', {})
352
+ if proverbs:
353
+ proverb, meaning = random.choice(list(proverbs.items()))
354
+ return f"{proverb} - '{meaning}'"
355
+ return "Hakuna matata - No worries"
356
+
357
+ def generate_kiswahili_response(self, english_text, complexity="medium"):
358
+ """
359
+ Generate Kiswahili-enhanced response based on English input
360
+ """
361
+ # Analyze the input for appropriate Kiswahili integration
362
+ kiswahili_elements = self._analyze_for_kiswahili(english_text)
363
+
364
+ enhanced_response = english_text
365
+
366
+ # Add appropriate Kiswahili elements based on context
367
+ if kiswahili_elements.get('greeting'):
368
+ enhanced_response = f"Jambo! {enhanced_response}"
369
+
370
+ if kiswahili_elements.get('lion_king_context'):
371
+ # Add Lion King relevant Kiswahili
372
+ lion_phrase = self._get_lion_king_phrase()
373
+ enhanced_response = f"{enhanced_response} {lion_phrase}"
374
+
375
+ if kiswahili_elements.get('cultural_context'):
376
+ # Add cultural wisdom
377
+ proverb = self.get_random_proverb()
378
+ enhanced_response = f"{enhanced_response}\n\nKama wasemavyo Wasawnili: {proverb}"
379
+
380
+ return enhanced_response
381
+
382
+ def _analyze_for_kiswahili(self, text):
383
+ """Analyze text to determine appropriate Kiswahili integration"""
384
+ text_lower = text.lower()
385
+
386
+ analysis = {
387
+ 'greeting': any(word in text_lower for word in ['hello', 'hi', 'greeting']),
388
+ 'lion_king_context': any(word in text_lower for word in ['lion king', 'simba', 'mufasa', 'rafiki']),
389
+ 'cultural_context': any(word in text_lower for word in ['culture', 'tradition', 'africa', 'wisdom']),
390
+ 'philosophical': any(word in text_lower for word in ['life', 'purpose', 'meaning', 'philosophy'])
391
+ }
392
+
393
+ return analysis
394
+
395
+ def _get_lion_king_phrase(self):
396
+ """Get appropriate Lion King Kiswahili phrase"""
397
+ import random
398
+ phrases = [
399
+ "Hakuna Matata!",
400
+ "Kumbuka wewe ni nani - Remember who you are!",
401
+ "Mduara wa Uhai unadumu - The Circle of Life continues!",
402
+ "Asante sana kwa kukumbuka - Thank you for remembering!"
403
+ ]
404
+ return random.choice(phrases)
405
+
406
+ def get_comprehensive_kiswahili_lesson(self, topic):
407
+ """Generate comprehensive Kiswahili learning content"""
408
+ lessons = {
409
+ "greetings": self._generate_greetings_lesson(),
410
+ "basics": self._generate_basics_lesson(),
411
+ "lion_king": self._generate_lion_king_lesson(),
412
+ "culture": self._generate_culture_lesson()
413
+ }
414
+ return lessons.get(topic, "Hakuna somo kwa hilo mada - No lesson for that topic")
415
+
416
+ def _generate_greetings_lesson(self):
417
+ """Generate greetings lesson"""
418
+ return """
419
+ πŸ“š **Kiswahili Greetings Lesson**
420
+
421
+ **Formal Greetings:**
422
+ - Shikamoo (to elders) β†’ Marahaba (response)
423
+ - Habari za asubuhi? (Good morning?)
424
+ - Habari za mchana? (Good afternoon?)
425
+
426
+ **Informal Greetings:**
427
+ - Mambo? β†’ Poa (What's up? β†’ Cool)
428
+ - Vipi? (How's it going?)
429
+ - Sema! (Speak!)
430
+
431
+ **Responses:**
432
+ - Nzuri (Good)
433
+ - Safi (Clean/Cool)
434
+ - Salama (Peaceful)
435
+
436
+ **Example Conversation:**
437
+ Person A: "Mambo?"
438
+ Person B: "Poa! Na wewe?"
439
+ Person A: "Safi sana!"
440
+ """
441
+
442
+ def _generate_basics_lesson(self):
443
+ """Generate basic phrases lesson"""
444
+ return """
445
+ πŸ“š **Kiswahili Basics Lesson**
446
+
447
+ **Essential Phrases:**
448
+ - Asante (Thank you)
449
+ - Tafadhali (Please)
450
+ - Samahani (Excuse me)
451
+ - Karibu (You're welcome)
452
+
453
+ **Common Responses:**
454
+ - Ndio (Yes)
455
+ - Hapana (No)
456
+ - Sawa (Okay)
457
+ - Labda (Maybe)
458
+
459
+ **Key Expressions:**
460
+ - Hakuna matata (No worries)
461
+ - Pole pole (Slowly slowly)
462
+ - Asante sana (Thank you very much)
463
+ """
464
+
465
+ def _generate_lion_king_lesson(self):
466
+ """Generate Lion King Kiswahili lesson"""
467
+ return """
468
+ 🎬 **Lion King Kiswahili Lesson**
469
+
470
+ **Character Names & Meanings:**
471
+ - Simba = Lion 🦁
472
+ - Nala = Gift 🎁
473
+ - Rafiki = Friend 🀝
474
+ - Mufasa = King πŸ‘‘
475
+ - Pumbaa = Simpleton πŸ—
476
+ - Timon = Respect πŸ™
477
+
478
+ **Key Phrases:**
479
+ - Hakuna Matata = No worries
480
+ - Kumbuka wewe ni nani = Remember who you are
481
+ - Mduara wa Uhai = Circle of Life
482
+
483
+ **Cultural Context:**
484
+ All character names are authentic Swahili words that reflect their personalities and roles in the story!
485
+ """
486
+
487
+ def _generate_culture_lesson(self):
488
+ """Generate cultural context lesson"""
489
+ return """
490
+ 🌍 **Swahili Culture Lesson**
491
+
492
+ **Important Concepts:**
493
+ - Ujamaa = Familyhood/Community
494
+ - Harambee = Pull together
495
+ - Ubuntu = Humanity towards others
496
+ - Pole pole = Take your time
497
+
498
+ **Traditional Values:**
499
+ - Respect for elders (Shikamoo/Marahaba)
500
+ - Community before individual
501
+ - Hospitality to guests (Karibu!)
502
+ - Indirect communication style
503
+
504
+ **Famous Proverbs:**
505
+ - "Haraka haraka haina baraka" (Hurry hurry has no blessing)
506
+ - "Mwacha mila ni mtumwa" (He who abandons his culture is a slave)
507
+ """
508
+
509
+
510
+ # Utility functions for easy access
511
+ def get_kiswahili_knowledge():
512
+ """Quick access to Kiswahili knowledge base"""
513
+ return KiswahiliKnowledgeBase()
514
+
515
+ def enhance_with_kiswahili(text, context=None):
516
+ """Enhance English text with appropriate Kiswahili elements"""
517
+ kb = KiswahiliKnowledgeBase()
518
+ return kb.generate_kiswahili_response(text)
519
+
520
+ def get_lion_king_insights(character=None):
521
+ """Get Lion King character insights"""
522
+ kb = KiswahiliKnowledgeBase()
523
+ if character:
524
+ return kb.get_lion_king_character(character)
525
+ return kb.lion_king_lore
526
+
527
+
528
+ if __name__ == "__main__":
529
+ # Test the knowledge base
530
+ kb = KiswahiliKnowledgeBase()
531
+ print("🦁 STANLEY AI - Kiswahili Knowledge Base Loaded!")
532
+ print(f"πŸ“š Contains {len(kb.kiswahili_data)} main categories")
533
+ print(f"🌍 {len(kb.cultural_context)} cultural sections")
534
+ print(f"🎬 {len(kb.lion_king_lore)} Lion King knowledge areas")
535
+ print(f"πŸ’¬ {len(kb.advanced_phrases)} advanced phrase categories")
536
+
537
+ # Test a sample
538
+ print("\n" + "="*50)
539
+ print("Sample Kiswahili Greeting:")
540
+ print(kb.get_kiswahili_phrase("greetings", "formal", "Shikamoo"))
541
+ print("\nSample Proverb:")
542
+ print(kb.get_random_proverb())