th commited on
Commit
84bace8
·
1 Parent(s): ca484f2

feat: implement full English BaZi interpretation generation

Browse files

- Add _DAY_MASTER_EN, _ELEMENT_EN, _PATTERN_LEVEL_EN class-level dicts
- Add _generate_english_basic_sections() dispatcher
- Add 6 English methods: personality, career, wealth, marriage, health, overall
- _generate_basic_interpretation() now branches on language='en'
- Word count uses split() for English vs len() for Chinese

🦊 Generated with Sisi

Files changed (1) hide show
  1. ai_interpreter.py +429 -15
ai_interpreter.py CHANGED
@@ -202,23 +202,25 @@ class AIInterpreter:
202
  生成基础版解读(3000字)
203
  Sections: personality, career, wealth, marriage, health, overall
204
  """
205
- sections = {
206
- 'personality': self._interpret_personality(),
207
- 'career': self._interpret_career(),
208
- 'wealth': self._interpret_wealth(),
209
- 'marriage': self._interpret_marriage(),
210
- 'health': self._interpret_health(),
211
- 'overall': self._interpret_overall(),
212
- }
213
-
214
- # 计算字数
215
- word_count = sum(len(text) for text in sections.values())
 
 
216
 
217
- # TODO: 翻译成其他语言
218
  if language == 'en':
219
- pass # sections = self._translate_to_english(sections)
220
- elif language == 'zh-TW':
221
- pass # sections = self._translate_to_traditional_chinese(sections)
222
 
223
  return {
224
  'level': 'basic',
@@ -228,6 +230,418 @@ class AIInterpreter:
228
  'generated_at': datetime.datetime.now().isoformat(),
229
  }
230
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
231
  def _generate_professional_interpretation(self, language: str) -> Dict[str, Any]:
232
  """
233
  生成专业版解读(8000字)
 
202
  生成基础版解读(3000字)
203
  Sections: personality, career, wealth, marriage, health, overall
204
  """
205
+ if language == 'en':
206
+ sections = self._generate_english_basic_sections()
207
+ else:
208
+ sections = {
209
+ 'personality': self._interpret_personality(),
210
+ 'career': self._interpret_career(),
211
+ 'wealth': self._interpret_wealth(),
212
+ 'marriage': self._interpret_marriage(),
213
+ 'health': self._interpret_health(),
214
+ 'overall': self._interpret_overall(),
215
+ }
216
+ if language == 'zh-TW':
217
+ pass # Traditional Chinese conversion placeholder
218
 
219
+ # 计算字数 / word count
220
  if language == 'en':
221
+ word_count = sum(len(text.split()) for text in sections.values())
222
+ else:
223
+ word_count = sum(len(text) for text in sections.values())
224
 
225
  return {
226
  'level': 'basic',
 
230
  'generated_at': datetime.datetime.now().isoformat(),
231
  }
232
 
233
+ def _generate_english_basic_sections(self) -> Dict[str, str]:
234
+ """
235
+ Generate English basic interpretation sections.
236
+ Directly generates English text from BaZi data — no translation needed.
237
+ """
238
+ return {
239
+ 'personality': self._interpret_personality_en(),
240
+ 'career': self._interpret_career_en(),
241
+ 'wealth': self._interpret_wealth_en(),
242
+ 'marriage': self._interpret_marriage_en(),
243
+ 'health': self._interpret_health_en(),
244
+ 'overall': self._interpret_overall_en(),
245
+ }
246
+
247
+ # ==================== English Interpretation Methods ====================
248
+
249
+ # Day Master English descriptions
250
+ _DAY_MASTER_EN = {
251
+ '甲': {
252
+ 'name': 'Yang Wood (甲)',
253
+ 'nature': 'tall oak — upright, ambitious, and growth-oriented',
254
+ 'desc': 'You are a natural leader with unwavering principles. Like a towering tree, you stand tall and reach toward the light. You possess strong integrity, a clear sense of purpose, and the drive to make a meaningful impact. You thrive when given room to grow and lead.',
255
+ 'traits': ['principled', 'ambitious', 'visionary', 'decisive', 'independent'],
256
+ },
257
+ '乙': {
258
+ 'name': 'Yin Wood (乙)',
259
+ 'nature': 'flowering vine — adaptive, graceful, and resilient',
260
+ 'desc': 'You are highly adaptable and skilled at finding opportunities in any environment. Like a vine that finds its way through obstacles, you navigate life with elegance and flexibility. Your diplomatic nature makes you excellent at building relationships and bridging differences.',
261
+ 'traits': ['adaptable', 'diplomatic', 'graceful', 'resilient', 'charming'],
262
+ },
263
+ '丙': {
264
+ 'name': 'Yang Fire (丙)',
265
+ 'nature': 'blazing sun — radiant, passionate, and inspiring',
266
+ 'desc': 'You radiate warmth and enthusiasm that naturally draws people toward you. Like the sun, your energy lights up every room you enter. You are charismatic, optimistic, and genuinely care about the people around you. Your passion and visibility make you a natural public figure.',
267
+ 'traits': ['charismatic', 'passionate', 'warm', 'generous', 'inspiring'],
268
+ },
269
+ '丁': {
270
+ 'name': 'Yin Fire (丁)',
271
+ 'nature': 'candlelight — refined, perceptive, and illuminating',
272
+ 'desc': 'You possess a quiet yet powerful intelligence that illuminates what others miss. Like candlelight, your wisdom provides warmth and clarity in close circles. You are insightful, artistic, and deeply observant — often understanding people and situations before they fully reveal themselves.',
273
+ 'traits': ['perceptive', 'refined', 'artistic', 'intuitive', 'thoughtful'],
274
+ },
275
+ '戊': {
276
+ 'name': 'Yang Earth (戊)',
277
+ 'nature': 'mountain — stable, reliable, and enduring',
278
+ 'desc': 'You are a pillar of strength and dependability. Like a mountain, you provide stability and protection for those around you. Your steady nature and long-term thinking make you trustworthy and respected. You build things to last — relationships, businesses, and legacies.',
279
+ 'traits': ['stable', 'reliable', 'protective', 'patient', 'trustworthy'],
280
+ },
281
+ '己': {
282
+ 'name': 'Yin Earth (己)',
283
+ 'nature': 'fertile soil — nurturing, meticulous, and supportive',
284
+ 'desc': 'You have a remarkable ability to help others grow and thrive. Like rich farmland, you provide the conditions for success around you. You are thoughtful, detail-oriented, and genuinely invested in the wellbeing of those in your care. Your practicality and warmth make you indispensable.',
285
+ 'traits': ['nurturing', 'meticulous', 'supportive', 'practical', 'caring'],
286
+ },
287
+ '庚': {
288
+ 'name': 'Yang Metal (庚)',
289
+ 'nature': 'steel sword — decisive, principled, and sharp',
290
+ 'desc': 'You possess extraordinary determination and a strong moral compass. Like refined steel, you cut through confusion with clarity and courage. You are results-oriented, disciplined, and not afraid of necessary confrontation. Your strength of character earns deep respect from those who know you.',
291
+ 'traits': ['decisive', 'principled', 'disciplined', 'courageous', 'direct'],
292
+ },
293
+ '辛': {
294
+ 'name': 'Yin Metal (辛)',
295
+ 'nature': 'precious gem — precise, aesthetic, and refined',
296
+ 'desc': 'You have an exceptional eye for quality, beauty, and excellence. Like a finely cut gem, you have high standards for yourself and your environment. You are precise, elegant, and deeply sensitive to aesthetics. Your attention to detail and refined taste set you apart in creative and intellectual fields.',
297
+ 'traits': ['precise', 'aesthetic', 'detail-oriented', 'sensitive', 'elegant'],
298
+ },
299
+ '壬': {
300
+ 'name': 'Yang Water (壬)',
301
+ 'nature': 'deep ocean — strategic, wise, and unstoppable',
302
+ 'desc': 'You possess remarkable depth of mind and the ability to navigate complex situations with ease. Like a great river, you adapt to every obstacle while maintaining momentum toward your destination. You are strategic, perceptive, and naturally drawn to the big picture. Your quiet confidence inspires trust.',
303
+ 'traits': ['strategic', 'wise', 'adaptable', 'insightful', 'confident'],
304
+ },
305
+ '癸': {
306
+ 'name': 'Yin Water (癸)',
307
+ 'nature': 'gentle rain — intuitive, reflective, and deep',
308
+ 'desc': 'You have extraordinary emotional intelligence and an almost psychic ability to sense what others feel. Like nurturing rain, you sustain and support in quiet but essential ways. You are reflective, compassionate, and deeply intuitive. Your inner world is rich, and your insights often feel prophetic.',
309
+ 'traits': ['intuitive', 'empathetic', 'reflective', 'gentle', 'perceptive'],
310
+ },
311
+ }
312
+
313
+ _ELEMENT_EN = {
314
+ 'wood': 'Wood', 'fire': 'Fire', 'earth': 'Earth', 'metal': 'Metal', 'water': 'Water'
315
+ }
316
+
317
+ _PATTERN_LEVEL_EN = {
318
+ '上上等': 'Exceptional',
319
+ '上等': 'Superior',
320
+ '中上等': 'Above Average',
321
+ '中等': 'Average',
322
+ '中下等': 'Below Average',
323
+ '下等': 'Challenging',
324
+ }
325
+
326
+ def _interpret_personality_en(self) -> str:
327
+ dm_info = self._DAY_MASTER_EN.get(self.day_master, {
328
+ 'name': f'{self.day_master} Day Master',
329
+ 'nature': 'unique and complex',
330
+ 'desc': 'You have a distinctive character shaped by your birth chart.',
331
+ 'traits': ['unique', 'complex', 'multifaceted'],
332
+ })
333
+
334
+ text = f"**Your Day Master: {dm_info['name']}**\n\n"
335
+ text += f"Your core nature is like a {dm_info['nature']}.\n\n"
336
+ text += dm_info['desc'] + "\n\n"
337
+
338
+ traits = dm_info.get('traits', [])
339
+ if traits:
340
+ text += f"**Key personality traits:** {', '.join(traits[:5])}.\n\n"
341
+
342
+ # Add strength context
343
+ if self.genju:
344
+ pattern_level = self.pattern_level or 'Average'
345
+ level_en = self._PATTERN_LEVEL_EN.get(pattern_level, pattern_level)
346
+ wuxing = self.genju.get('wuxing_stats', {})
347
+ dominant = max(wuxing.items(), key=lambda x: x[1])[0] if wuxing else ''
348
+ element_en = self._ELEMENT_EN.get(dominant, dominant)
349
+ if dominant:
350
+ text += f"Your chart shows a strong presence of {element_en} energy, which amplifies your natural {dm_info['name'].split('(')[0].strip()} qualities. "
351
+
352
+ if self.pattern:
353
+ text += f"\n\n**Chart Pattern:** Your BaZi chart forms what classical texts call the {self.pattern} pattern — a configuration that shapes your life path and approach to success."
354
+
355
+ return text
356
+
357
+ def _interpret_career_en(self) -> str:
358
+ if not self.genju:
359
+ return "For career guidance, your BaZi chart suggests focusing on your natural strengths and working in environments that align with your Day Master element."
360
+
361
+ career_suggestions = self.genju.get('career_suggestions', {})
362
+ primary = career_suggestions.get('recommended_primary', [])
363
+ secondary = career_suggestions.get('recommended_secondary', [])
364
+ best_industry = career_suggestions.get('best_industry', '')
365
+
366
+ # Map Chinese career names to English
367
+ career_map_en = {
368
+ '教育培训': 'Education & Training', '咨询顾问': 'Consulting & Advisory',
369
+ '政府机关': 'Government & Public Service', '法律': 'Law & Legal Services',
370
+ '金融投资': 'Finance & Investment', '房地产': 'Real Estate',
371
+ '科技IT': 'Technology & IT', '创意设计': 'Creative Design',
372
+ '营销传媒': 'Marketing & Media', '医疗健康': 'Healthcare & Medicine',
373
+ '管理行政': 'Management & Administration', '商业贸易': 'Business & Trade',
374
+ '艺术创作': 'Arts & Creative Work', '研究学术': 'Research & Academia',
375
+ }
376
+
377
+ text = "**Career Path & Professional Strengths**\n\n"
378
+
379
+ dm_element = self.day_master_element
380
+ element_en = self._ELEMENT_EN.get(dm_element, dm_element)
381
+ text += f"As a {element_en}-element Day Master, your natural career strengths align with {element_en} energy:\n\n"
382
+
383
+ if primary:
384
+ text += "**Best career directions:**\n"
385
+ for i, career in enumerate(primary[:3], 1):
386
+ career_en = career_map_en.get(career, career)
387
+ text += f"{i}. {career_en}\n"
388
+ text += "\n"
389
+
390
+ if secondary:
391
+ secondary_en = [career_map_en.get(c, c) for c in secondary[:3]]
392
+ text += f"**Also well-suited for:** {', '.join(secondary_en)}\n\n"
393
+
394
+ if best_industry:
395
+ industry_en = career_map_en.get(best_industry, best_industry)
396
+ text += f"**Ideal industry:** {industry_en}\n\n"
397
+
398
+ # Current Dayun context
399
+ if self.dayun:
400
+ current = self._get_current_dayun()
401
+ if current:
402
+ quality = current['judgment']['quality']
403
+ age_range = current['age_range']
404
+ if quality in ['excellent', 'good']:
405
+ text += f"**Current fortune cycle ({age_range}):** This is a favorable period for career advancement. Bold moves and new opportunities are well-supported right now."
406
+ else:
407
+ text += f"**Current fortune cycle ({age_range}):** This cycle favors consolidation and skill-building over dramatic leaps. Build your foundation — your peak career years are coming."
408
+
409
+ return text
410
+
411
+ def _interpret_wealth_en(self) -> str:
412
+ if not self.genju:
413
+ return "Your wealth potential is shaped by your Five Elements balance and chart pattern. Focus on leveraging your favorable elements for financial growth."
414
+
415
+ wealth_analysis = self.genju.get('wealth_analysis', {})
416
+ wealth_level = wealth_analysis.get('wealth_level', '中等')
417
+ wealth_score = wealth_analysis.get('wealth_score', 50)
418
+
419
+ wealth_level_map = {
420
+ '极旺': ('Exceptional', 'strong wealth indicators across your chart'),
421
+ '旺': ('Strong', 'multiple wealth stars supporting your financial path'),
422
+ '偏旺': ('Above Average', 'good wealth potential with some volatility'),
423
+ '中等': ('Steady', 'consistent wealth-building capacity'),
424
+ '偏弱': ('Developing', 'wealth grows through patience and strategic effort'),
425
+ '弱': ('Challenging', 'wealth requires discipline and smart positioning'),
426
+ }
427
+
428
+ level_info = wealth_level_map.get(wealth_level, ('Steady', 'consistent earning potential'))
429
+
430
+ text = f"**Wealth Potential: {level_info[0]} (Score: {wealth_score}/100)**\n\n"
431
+ text += f"Your BaZi chart shows {level_info[1]}.\n\n"
432
+
433
+ # Pattern-based wealth type
434
+ if self.pattern:
435
+ if '偏财' in self.pattern:
436
+ text += "**Wealth style:** You are built for entrepreneurial, opportunistic wealth — investments, side ventures, and unexpected windfalls come naturally to you. Multiple income streams suit your chart.\n\n"
437
+ elif '正财' in self.pattern:
438
+ text += "**Wealth style:** You are built for stable, accumulative wealth through consistent effort. A steady salary or professional income suits your chart best. Long-term saving and conservative investment work well for you.\n\n"
439
+ else:
440
+ text += "**Wealth style:** Your wealth comes through your professional excellence and strategic relationships. Career growth and reputation directly translate to financial gains.\n\n"
441
+
442
+ # Advice
443
+ advice = wealth_analysis.get('advice', [])
444
+ if advice:
445
+ text += "**Financial guidance:**\n"
446
+ # Map common advice to English
447
+ advice_map = {
448
+ '稳健理财': '• Focus on steady, low-risk wealth building',
449
+ '把握机会': '• Seize opportunistic moments when they arise',
450
+ '多元化投资': '• Diversify your income streams',
451
+ '谨慎投资': '• Be selective and cautious with investments',
452
+ '积累资本': '• Prioritize capital accumulation over spending',
453
+ }
454
+ for item in advice[:3]:
455
+ mapped = advice_map.get(item, f'• {item}')
456
+ text += f"{mapped}\n"
457
+
458
+ if self.dayun:
459
+ current = self._get_current_dayun()
460
+ if current:
461
+ wealth_events = current['events'].get('wealth', [])
462
+ if wealth_events:
463
+ text += f"\n**Current wealth cycle ({current['age_range']}):** This period "
464
+ if current['judgment']['quality'] in ['excellent', 'good']:
465
+ text += "supports financial growth and new income opportunities."
466
+ else:
467
+ text += "calls for financial caution — protect existing assets and avoid major risks."
468
+
469
+ return text
470
+
471
+ def _interpret_marriage_en(self) -> str:
472
+ if not self.genju:
473
+ gender_text = "husband" if self.gender == 'female' else "wife"
474
+ return f"Your marriage prospects depend on finding a partner whose {gender_text}'s energy complements your Day Master. Timing and compatibility are key."
475
+
476
+ marriage_analysis = self.genju.get('marriage_analysis', {})
477
+ marriage_level = marriage_analysis.get('marriage_level', '中等')
478
+ marriage_score = marriage_analysis.get('marriage_score', 50)
479
+
480
+ quality_map = {
481
+ '很好': ('Excellent', 'Your chart strongly supports a harmonious, loving partnership.'),
482
+ '良好': ('Good', 'Your chart indicates a stable, supportive marriage with genuine connection.'),
483
+ '中等': ('Stable', 'Your marriage will be steady and workable, built on mutual respect and shared effort.'),
484
+ '一般': ('Mixed', 'Your marriage journey has some complexity — patience and communication are essential.'),
485
+ '需要努力': ('Challenging', 'Marriage requires significant investment and intentional effort from both partners.'),
486
+ }
487
+
488
+ level_info = quality_map.get(marriage_level, ('Moderate', 'Your marriage prospects are moderate.'))
489
+
490
+ text = f"**Marriage Prospects: {level_info[0]} (Score: {marriage_score}/100)**\n\n"
491
+ text += level_info[1] + "\n\n"
492
+
493
+ # Use genju description if available
494
+ genju_desc = marriage_analysis.get('description', '')
495
+ if genju_desc:
496
+ # The description may be in Chinese — provide a structured English summary instead
497
+ text += "**What your chart reveals about partnership:**\n"
498
+ if marriage_level in ['很好', '良好']:
499
+ text += "• You naturally attract partners who complement your strengths\n"
500
+ text += "• Your marriage palace (Day Branch) shows stability and warmth\n"
501
+ text += "• Emotional harmony comes relatively easily in your relationships\n"
502
+ elif marriage_level in ['中等']:
503
+ text += "• Your partnership works best with open communication\n"
504
+ text += "• Choose a partner whose element supports or balances yours\n"
505
+ text += "• Middle life brings the most stable romantic energy\n"
506
+ else:
507
+ text += "• Marriage thrives when you allow vulnerability and trust\n"
508
+ text += "• Avoid rushing into commitment — timing matters significantly for you\n"
509
+ text += "• A partner who understands your complexity is key\n"
510
+
511
+ # Advice
512
+ advice = marriage_analysis.get('advice', [])
513
+ if advice:
514
+ text += "\n**Relationship guidance:**\n"
515
+ for item in advice[:3]:
516
+ text += f"• {item}\n"
517
+
518
+ if self.dayun:
519
+ current = self._get_current_dayun()
520
+ if current:
521
+ marriage_events = current['events'].get('marriage', [])
522
+ if marriage_events:
523
+ text += f"\n**Current cycle romance ({current['age_range']}):** "
524
+ if current['judgment']['quality'] in ['excellent', 'good']:
525
+ text += "A favorable period for romantic encounters and deepening partnerships."
526
+ else:
527
+ text += "Prioritize emotional self-awareness in relationships during this cycle."
528
+
529
+ return text
530
+
531
+ def _interpret_health_en(self) -> str:
532
+ element = self.day_master_element
533
+ element_en = self._ELEMENT_EN.get(element, element)
534
+
535
+ health_map_en = {
536
+ 'wood': {
537
+ 'system': 'liver, gallbladder, nervous system, and eyes',
538
+ 'advice': 'Manage stress and anger, which are Wood\'s main vulnerabilities. Regular movement — especially walks in nature — nourishes your element. Prioritize sleep to protect your nervous system.',
539
+ 'foods': 'leafy greens, sprouts, sour foods (vinegar, citrus)',
540
+ 'exercise': 'yoga, tai chi, walking, stretching',
541
+ 'risk': 'tension headaches, digestive issues related to stress, and eye strain',
542
+ },
543
+ 'fire': {
544
+ 'system': 'heart, small intestine, circulatory system, and blood vessels',
545
+ 'advice': 'Protect your heart through emotional balance — excessive joy and anxiety both challenge Fire energy. Avoid overexertion and practice calming activities to prevent cardiovascular strain.',
546
+ 'foods': 'bitter greens, red berries, nuts, whole grains',
547
+ 'exercise': 'swimming, moderate cardio, breathing exercises',
548
+ 'risk': 'cardiovascular issues, insomnia, anxiety, and inflammation',
549
+ },
550
+ 'earth': {
551
+ 'system': 'stomach, spleen, pancreas, and digestive system',
552
+ 'advice': 'Your digestive health is your foundation. Eat at regular times, avoid overthinking during meals, and limit excessive worry — your biggest health risk. Warming, easy-to-digest foods support your Earth element.',
553
+ 'foods': 'root vegetables, whole grains, warm soups, yellow foods',
554
+ 'exercise': 'gentle walking, light resistance training, qigong',
555
+ 'risk': 'digestive problems, weight fluctuations, bloating, and fatigue from overthinking',
556
+ },
557
+ 'metal': {
558
+ 'system': 'lungs, large intestine, skin, and immune system',
559
+ 'advice': 'Keep your respiratory system strong through clean air, proper breathing, and avoiding environmental pollutants. Your immune system benefits from consistent routines and avoiding over-rigidity in lifestyle.',
560
+ 'foods': 'white/pungent foods, pears, almonds, garlic, onions',
561
+ 'exercise': 'breathing exercises, martial arts, swimming',
562
+ 'risk': 'respiratory conditions, skin issues, constipation, and immune sensitivity',
563
+ },
564
+ 'water': {
565
+ 'system': 'kidneys, bladder, bones, and reproductive system',
566
+ 'advice': 'Protect your kidney energy — the root of all vitality in Chinese medicine. Avoid excessive cold, overwork, and fear. Adequate rest and hydration are crucial. Warm your lower back and feet.',
567
+ 'foods': 'dark/salty foods, seafood, black sesame, kidney beans, bone broth',
568
+ 'exercise': 'swimming, tai chi, meditation, light walking',
569
+ 'risk': 'lower back problems, urinary issues, bone density concerns, and reproductive health',
570
+ },
571
+ }
572
+
573
+ info = health_map_en.get(element, {
574
+ 'system': 'multiple organ systems',
575
+ 'advice': 'Maintain balanced lifestyle, regular check-ups, and manage stress effectively.',
576
+ 'foods': 'balanced, seasonal foods',
577
+ 'exercise': 'moderate, consistent activity',
578
+ 'risk': 'stress-related conditions',
579
+ })
580
+
581
+ text = f"**Health & Wellbeing — {element_en} Day Master**\n\n"
582
+ text += f"**Key systems to protect:** {info['system'].title()}\n\n"
583
+ text += f"**Health guidance:** {info['advice']}\n\n"
584
+ text += f"**Supportive foods:** {info['foods'].title()}\n\n"
585
+ text += f"**Recommended movement:** {info['exercise'].title()}\n\n"
586
+ text += f"**Watch out for:** {info['risk'].title()}\n\n"
587
+
588
+ if self.dayun:
589
+ current = self._get_current_dayun()
590
+ if current:
591
+ quality = current['judgment']['quality']
592
+ text += f"**Current cycle health ({current['age_range']}):** "
593
+ if quality in ['excellent', 'good']:
594
+ text += "Energy and vitality are well-supported. Maintain your healthy routines and build your physical reserve."
595
+ else:
596
+ text += "Pay extra attention to health during this cycle. Regular check-ups and preventive care are especially important."
597
+
598
+ return text
599
+
600
+ def _interpret_overall_en(self) -> str:
601
+ if not self.genju:
602
+ return "Your BaZi chart is a unique map of your life's potential. Work with your natural strengths, time your key decisions wisely, and remember that fortune is shaped as much by action as by destiny."
603
+
604
+ pattern_level = self.pattern_level or '中等'
605
+ score = self.genju['pattern_level'].get('score', 50)
606
+ level_en = self._PATTERN_LEVEL_EN.get(pattern_level, 'Average')
607
+
608
+ dm_info = self._DAY_MASTER_EN.get(self.day_master, {'name': f'{self.day_master} Day Master'})
609
+ element_en = self._ELEMENT_EN.get(self.day_master_element, self.day_master_element)
610
+
611
+ text = f"**Overall Life Fortune: {level_en} (Score: {score}/100)**\n\n"
612
+
613
+ # Life stage summary
614
+ if self.dayun and 'life_stages' in self.dayun:
615
+ stages = self.dayun['life_stages']
616
+ best_stage = stages.get('best_stage', 'middle')
617
+ stage_map_en = {'early': 'early years (0–30)', 'middle': 'middle years (30–60)', 'late': 'later years (60+)'}
618
+ best_stage_en = stage_map_en.get(best_stage, 'middle years')
619
+
620
+ early_score = stages.get('early_years', {}).get('avg_score', 50)
621
+ middle_score = stages.get('middle_years', {}).get('avg_score', 50)
622
+ late_score = stages.get('late_years', {}).get('avg_score', 50)
623
+
624
+ text += f"**Life trajectory overview:**\n"
625
+ text += f"• Early years (0–30): {'Favorable' if early_score >= 60 else 'Building'} — Score {early_score}/100\n"
626
+ text += f"• Middle years (30–60): {'Peak period' if middle_score >= 60 else 'Steady'} — Score {middle_score}/100\n"
627
+ text += f"• Later years (60+): {'Rewarding' if late_score >= 60 else 'Reflective'} — Score {late_score}/100\n\n"
628
+ text += f"**Your peak life period:** Your {best_stage_en} represent your greatest window for achievement and fulfillment.\n\n"
629
+
630
+ # Strategic advice by level
631
+ if score >= 75:
632
+ text += f"**Your destiny in a sentence:** You carry significant natural fortune — the kind that opens doors when you combine your {element_en}-element strengths with persistent effort.\n\n"
633
+ text += "**Strategic focus:** Don't waste your fortunate window. Set ambitious goals, build strong networks, and execute with discipline. Your chart supports major achievement.\n\n"
634
+ elif score >= 55:
635
+ text += f"**Your destiny in a sentence:** Your chart is steady and capable — you have the tools to build a meaningful, successful life through consistent effort and smart timing.\n\n"
636
+ text += "**Strategic focus:** Focus on your genuine strengths rather than trying to compensate for weaknesses. Timing your major decisions with your favorable cycles will significantly amplify your results.\n\n"
637
+ else:
638
+ text += f"**Your destiny in a sentence:** Your chart carries challenges that, when understood and accepted, become the very source of your resilience and hard-won wisdom.\n\n"
639
+ text += "**Strategic focus:** Lean into your support systems, choose your battles wisely, and trust that your most difficult periods are temporary. Every BaZi chart — no matter its difficulty rating — can lead to a deeply fulfilling life.\n\n"
640
+
641
+ text += "**Remember:** BaZi is a map, not a cage. Fortune is co-created by timing, effort, and the choices you make every day. Use this reading as a compass, not a verdict. 🌟"
642
+
643
+ return text
644
+
645
  def _generate_professional_interpretation(self, language: str) -> Dict[str, Any]:
646
  """
647
  生成专业版解读(8000字)