@@ -30,8 +30,9 @@ def __init__(self, vocab_manager: VocabularyManager):
3030 self .entity_database = {}
3131 self .analysis_history = []
3232
33- def analyze_entity_posture (self , entity_name : str , entity_type : str ,
34- recent_actions : str , historical_context : str = "" ) -> Dict :
33+ def analyze_entity_posture (
34+ self , entity_name : str , entity_type : str , recent_actions : str , historical_context : str = ""
35+ ) -> Dict :
3536 """
3637 Analyze geopolitical entity posture
3738
@@ -48,13 +49,12 @@ def analyze_entity_posture(self, entity_name: str, entity_type: str,
4849 recent_coords = self .vocab .analyze_concept (recent_actions )
4950
5051 # Analyze historical context if provided
51- historical_coords = (self .vocab .analyze_concept (historical_context )
52- if historical_context else Coordinates (0 , 0 , 0 , 0 ))
52+ historical_coords = (
53+ self .vocab .analyze_concept (historical_context ) if historical_context else Coordinates (0 , 0 , 0 , 0 )
54+ )
5355
5456 # Combine analyses (recent weighted higher)
55- combined_coords = self ._calculate_weighted_average (
56- [recent_coords , historical_coords ], [0.7 , 0.3 ]
57- )
57+ combined_coords = self ._calculate_weighted_average ([recent_coords , historical_coords ], [0.7 , 0.3 ])
5858
5959 result = self ._determine_posture_type (combined_coords , entity_name , entity_type )
6060
@@ -64,8 +64,7 @@ def analyze_entity_posture(self, entity_name: str, entity_type: str,
6464
6565 return result
6666
67- def _calculate_weighted_average (self , coords_list : List [Coordinates ],
68- weights : List [float ]) -> Coordinates :
67+ def _calculate_weighted_average (self , coords_list : List [Coordinates ], weights : List [float ]) -> Coordinates :
6968 """Calculate weighted average coordinates"""
7069 if not coords_list :
7170 return Coordinates (0 , 0 , 0 , 0 )
@@ -86,11 +85,10 @@ def _calculate_weighted_average(self, coords_list: List[Coordinates],
8685 love = weighted_love / total_weight ,
8786 justice = weighted_justice / total_weight ,
8887 power = weighted_power / total_weight ,
89- wisdom = weighted_wisdom / total_weight
88+ wisdom = weighted_wisdom / total_weight ,
9089 )
9190
92- def _determine_posture_type (self , coords : Coordinates , entity_name : str ,
93- entity_type : str ) -> Dict :
91+ def _determine_posture_type (self , coords : Coordinates , entity_name : str , entity_type : str ) -> Dict :
9492 """Determine geopolitical posture type based on coordinates"""
9593 distance = self .vocab .get_distance_from_anchor (coords )
9694 clarity = self .vocab .get_semantic_clarity (coords )
@@ -151,7 +149,7 @@ def _determine_posture_type(self, coords: Coordinates, entity_name: str,
151149 "stability_indicator" : 1.0 / distance if distance > 0 else 0 ,
152150 "cooperation_level" : coords .love + coords .justice if distance < 2.0 else 0 ,
153151 "aggression_level" : coords .power if distance > 2.0 else 0 ,
154- "wisdom_level" : coords .wisdom if distance < 2.0 else 0
152+ "wisdom_level" : coords .wisdom if distance < 2.0 else 0 ,
155153 }
156154
157155 def analyze_global_dynamics (self , entity_results : List [Dict ]) -> Dict :
@@ -183,11 +181,9 @@ def analyze_global_dynamics(self, entity_results: List[Dict]) -> Dict:
183181 avg_stability = total_stability / len (entity_results )
184182
185183 # Determine global trend
186- global_stability_trend = ("improving" if avg_stability > 0.7 else
187- "stable" if avg_stability > 0.4 else "volatile" )
184+ global_stability_trend = "improving" if avg_stability > 0.7 else "stable" if avg_stability > 0.4 else "volatile"
188185
189- logger .info (f"Global dynamics analysis: { len (entity_results )} entities, "
190- f"trend={ global_stability_trend } " )
186+ logger .info (f"Global dynamics analysis: { len (entity_results )} entities, " f"trend={ global_stability_trend } " )
191187
192188 return {
193189 "status" : "Analysis Complete" ,
@@ -197,8 +193,8 @@ def analyze_global_dynamics(self, entity_results: List[Dict]) -> Dict:
197193 "global_trend" : global_stability_trend ,
198194 "total_cooperation" : total_cooperation / len (entity_results ),
199195 "total_aggression" : total_aggression / len (entity_results ),
200- "total_wisdom" : total_wisdom / len (entity_results )
196+ "total_wisdom" : total_wisdom / len (entity_results ),
201197 },
202198 "posture_distribution" : posture_distribution ,
203- "global_stability_indicator" : avg_stability
199+ "global_stability_indicator" : avg_stability ,
204200 }
0 commit comments