th Claude Sonnet 4.5 commited on
Commit
82f25fe
·
1 Parent(s): 29e44a2

🔧 v3.14.1: 修复星曜组合匹配逻辑冲突

Browse files

## 修复内容
1. **添加excluded_stars检查逻辑** (star_combination_matcher.py)
- 在_check_rule_match中添加排除星曜检查
- 防止"无XX星"规则错误匹配有XX星的命盘

2. **修复SC373/SC616/SC1024孤君规则** (star_combination_rules.py)
- 添加excluded_stars: ['左辅', '右弼']
- 修复"紫微无左右为孤君"逻辑冲突
- SC1024原定义错误(要求有左右,名称却说无)已修正

## 验证结果
- 测试小鱼命盘(有左辅)
- 修复前:SC373/SC616/SC1024都错误匹配
- 修复后:孤君规则正确不匹配

🦊 Generated with Sisi

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>

star_combination_matcher.py CHANGED
@@ -326,6 +326,22 @@ class StarCombinationMatcher:
326
  'reason': f'缺少星曜:{set(required_stars) - set(matched_stars)}'
327
  }
328
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
329
  # 2. 检查四化条件(同宫条件已在_match_palace_combinations中处理)
330
  if conditions.get('transformations'):
331
  required_transformations = conditions['transformations']
 
326
  'reason': f'缺少星曜:{set(required_stars) - set(matched_stars)}'
327
  }
328
 
329
+ # 1.5. 检查是否包含排除的星曜(v3.14.1新增)
330
+ # 例如:"紫微无左右为孤君" 需要检查没有左辅右弼
331
+ excluded_stars = conditions.get('excluded_stars', [])
332
+ if excluded_stars:
333
+ found_excluded = []
334
+ for star in excluded_stars:
335
+ if star in palace_stars:
336
+ found_excluded.append(star)
337
+
338
+ if found_excluded:
339
+ return {
340
+ 'matched': False,
341
+ 'confidence': 0.0,
342
+ 'reason': f'包含排除星曜:{found_excluded}(不应该存在)'
343
+ }
344
+
345
  # 2. 检查四化条件(同宫条件已在_match_palace_combinations中处理)
346
  if conditions.get('transformations'):
347
  required_transformations = conditions['transformations']
star_combination_rules.py CHANGED
@@ -4345,7 +4345,8 @@ STAR_COMBINATION_RULES = [
4345
  'same_palace': True,
4346
  'transformations': None,
4347
  'brightness': None,
4348
- 'palace_position': None
 
4349
  },
4350
  "interpretations": {
4351
  'core_meaning': '紫微无左右辅佐为孤君,运限逢之主破财,外华内虚',
@@ -8420,7 +8421,8 @@ STAR_COMBINATION_RULES = [
8420
  'same_palace': True,
8421
  'transformations': None,
8422
  'brightness': None,
8423
- 'palace_position': None
 
8424
  },
8425
  "interpretations": {
8426
  'core_meaning': '紫微无左右辅佐为孤君,运限逢之主破财,外华内虚',
@@ -18439,13 +18441,14 @@ STAR_COMBINATION_RULES = [
18439
  "id": "SC1024",
18440
  "name": '紫微无左右之辅佐',
18441
  "category": RuleCategory.FORTUNE,
18442
- "stars_required": ['紫微', '左辅', '右弼'],
18443
  "palace_types": ['命宫'],
18444
  "conditions": {
18445
- 'same_palace': False,
18446
  'transformations': None,
18447
  'brightness': None,
18448
- 'palace_position': None
 
18449
  },
18450
  "interpretations": {
18451
  'core_meaning': '紫微无左右之辅佐为孤君,大小限逢无吉星来会主破财,外华内虚。',
 
4345
  'same_palace': True,
4346
  'transformations': None,
4347
  'brightness': None,
4348
+ 'palace_position': None,
4349
+ 'excluded_stars': ['左辅', '右弼'] # v3.14.1修复:孤君必须无左右辅弼
4350
  },
4351
  "interpretations": {
4352
  'core_meaning': '紫微无左右辅佐为孤君,运限逢之主破财,外华内虚',
 
8421
  'same_palace': True,
8422
  'transformations': None,
8423
  'brightness': None,
8424
+ 'palace_position': None,
8425
+ 'excluded_stars': ['左辅', '右弼'] # v3.14.1修复:孤君必须无左右辅弼
8426
  },
8427
  "interpretations": {
8428
  'core_meaning': '紫微无左右辅佐为孤君,运限逢之主破财,外华内虚',
 
18441
  "id": "SC1024",
18442
  "name": '紫微无左右之辅佐',
18443
  "category": RuleCategory.FORTUNE,
18444
+ "stars_required": ['紫微'],
18445
  "palace_types": ['命宫'],
18446
  "conditions": {
18447
+ 'same_palace': True,
18448
  'transformations': None,
18449
  'brightness': None,
18450
+ 'palace_position': None,
18451
+ 'excluded_stars': ['左辅', '右弼'] # v3.14.1修复:原定义错误,应该是排除左右
18452
  },
18453
  "interpretations": {
18454
  'core_meaning': '紫微无左右之辅佐为孤君,大小限逢无吉星来会主破财,外华内虚。',