Update aee_era_main.py
Browse files- aee_era_main.py +161 -178
aee_era_main.py
CHANGED
@@ -1,178 +1,161 @@
|
|
1 |
-
# aee_era_main.py
|
2 |
-
# AEE Era Sürümü İşlem Hattını Çalıştıran Ana Script
|
3 |
-
# Era Extractor ve Linker entegre edildi. (Era Adım 2 Tamamlandı - Proje Kodu Bitti!)
|
4 |
-
|
5 |
-
import time
|
6 |
-
from typing import Dict, List, Optional, Any
|
7 |
-
|
8 |
-
# Era sürümü klasöründeki TÜM modülleri import et
|
9 |
-
try:
|
10 |
-
from aee_core_classes_era import Proposition, EpistemicData
|
11 |
-
from aee_extractor_era import process_with_spacy, extract_propositions_era, NLP_MODEL # Era Extractor
|
12 |
-
from aee_linker_era import find_and_link_evidence_era # Era Linker
|
13 |
-
from aee_updater_era import run_updates_era # Era Updater
|
14 |
-
from aee_explainer_era import generate_explanation_era # Era Explainer
|
15 |
-
from aee_bias_detector import run_bias_detection_v3 # v3 Bias Detector
|
16 |
-
from aee_validator import check_plausibility_v_era # Era Validator
|
17 |
-
from aee_utils import get_proposition_by_id # Utils
|
18 |
-
except ImportError as e:
|
19 |
-
print(f"Fatal Error: Could not import necessary modules. Check file paths and dependencies in AEE/Era folder.")
|
20 |
-
print(f"Import Error: {e}")
|
21 |
-
exit()
|
22 |
-
|
23 |
-
# --- Raporlama Fonksiyonu (Era) ---
|
24 |
-
def report_kb_era(kb: Dict[str, Proposition]):
|
25 |
-
# ... (Öncekiyle aynı - değişiklik yok) ...
|
26 |
-
print("\n" + "="*70); print(" AEE Era Version - Knowledge Base Report (Final Status)"); print("="*70)
|
27 |
-
if not kb: print("Knowledge Base is empty."); print("="*70); return
|
28 |
-
print(f"Total propositions in KB: {len(kb)}"); print("-"*70)
|
29 |
-
propositions_by_source: Dict[str, List[Proposition]] = {};
|
30 |
-
def sort_key(prop): conf = prop.epistemic_data.computed_confidence; return conf if conf is not None else -1.0
|
31 |
-
sorted_props = sorted(list(kb.values()), key=sort_key, reverse=True)
|
32 |
-
for prop in sorted_props: source = prop.epistemic_data.source_id; propositions_by_source.setdefault(source, []).append(prop)
|
33 |
-
for source_id in sorted(propositions_by_source.keys()):
|
34 |
-
props = propositions_by_source[source_id]; source_reliability = getattr(props[0].epistemic_data, 'reliability_score', None)
|
35 |
-
reliability_str = f"{source_reliability:.2f}" if source_reliability is not None else "N/A"
|
36 |
-
print(f"\n--- Source: {source_id} (Calculated Reliability: {reliability_str}) ---")
|
37 |
-
for prop in props:
|
38 |
-
neg_str = "[NEGATED] " if prop.is_negated else ""
|
39 |
-
supports_str = ', '.join([pid[:8] for pid in prop.epistemic_data.supports]) if prop.epistemic_data.supports else "None"
|
40 |
-
contradicts_str = ', '.join([pid[:8] for pid in prop.epistemic_data.contradicts]) if prop.epistemic_data.contradicts else "None"
|
41 |
-
bias_str = ', '.join(prop.epistemic_data.bias_flags) if prop.epistemic_data.bias_flags else "None"
|
42 |
-
plausibility_score = prop.epistemic_data.plausibility_score; plausibility_str = f"{plausibility_score:.2f}" if plausibility_score is not None else "N/A"
|
43 |
-
validation_notes_str = ', '.join(prop.epistemic_data.validation_notes) if prop.epistemic_data.validation_notes else "None"
|
44 |
-
conf_score = prop.epistemic_data.computed_confidence; conf_str = f"{conf_score:.3f}" if conf_score is not None else "N/A"
|
45 |
-
init_conf_score = prop.epistemic_data.initial_confidence; init_conf_str = f"{init_conf_score:.2f}" if init_conf_score is not None else "N/A"
|
46 |
-
print(f" Prop ID : {prop.prop_id}")
|
47 |
-
print(f" Struct: {neg_str}{prop.subject_lemma} - {prop.relation_lemma} - {prop.value_lemma}")
|
48 |
-
print(f" Conf. : {conf_str} (Initial: {init_conf_str})") # Initial conf'un değiştiğini göreceğiz
|
49 |
-
print(f" Links : Supports: [{supports_str}] | Contradicts: [{contradicts_str}]")
|
50 |
-
print(f" Biases: [{bias_str}]")
|
51 |
-
print(f" Plaus.: {plausibility_str} | Notes: [{validation_notes_str}]")
|
52 |
-
print("\n" + "="*70); print(" End of KB Report "); print("="*70)
|
53 |
-
|
54 |
-
|
55 |
-
# --- Ana İşlem Fonksiyonu (Era - Final) ---
|
56 |
-
def run_aee_era_pipeline(inputs: List[Dict[str, str]]) -> Dict[str, Proposition]:
|
57 |
-
"""
|
58 |
-
Verilen girdiler için AEE Era işlem hattını tam olarak çalıştırır
|
59 |
-
(Era Extract, Plausibility Check, Era Linker, Bias Detect, Era Update).
|
60 |
-
"""
|
61 |
-
if NLP_MODEL is None: print("FATAL ERROR: spaCy model not loaded."); return {}
|
62 |
-
|
63 |
-
print("\nStarting AEE Era Final Pipeline...")
|
64 |
-
knowledge_base: Dict[str, Proposition] = {}
|
65 |
-
start_time = time.time()
|
66 |
-
|
67 |
-
# 1. Adım: Extract (Era) & Validate Plausibility & Link (Era)
|
68 |
-
print("Phase 1: Extracting(Era), Validating Plausibility, and Linking(Era)...")
|
69 |
-
all_extracted_props_before_linking: List[Proposition] = []
|
70 |
-
for item in inputs:
|
71 |
-
source_id = item.get("source_id", f"unknown_source_{int(time.time())}"); text = item.get("text", "")
|
72 |
-
if not text: continue
|
73 |
-
doc = process_with_spacy(text)
|
74 |
-
if doc:
|
75 |
-
# ERA EXTRACTOR ÇAĞIRILIYOR
|
76 |
-
extracted_props = extract_propositions_era(doc, source_id)
|
77 |
-
for prop in extracted_props:
|
78 |
-
plausibility_score, validation_notes = check_plausibility_v_era(prop)
|
79 |
-
if hasattr(prop, 'epistemic_data') and prop.epistemic_data:
|
80 |
-
prop.epistemic_data.plausibility_score = plausibility_score
|
81 |
-
if validation_notes: prop.epistemic_data.validation_notes.extend(validation_notes)
|
82 |
-
all_extracted_props_before_linking.append(prop)
|
83 |
-
print(f" Phase 1a (Extraction(Era) & Validation) complete. Total extracted: {len(all_extracted_props_before_linking)}")
|
84 |
-
|
85 |
-
print(" Phase 1b (Linking(Era))...")
|
86 |
-
if find_and_link_evidence_era: # Era linker fonksiyonu
|
87 |
-
for new_prop in all_extracted_props_before_linking:
|
88 |
-
if new_prop.prop_id not in knowledge_base:
|
89 |
-
# ERA LINKER ÇAĞIRILIYOR
|
90 |
-
find_and_link_evidence_era(new_prop, knowledge_base)
|
91 |
-
knowledge_base[new_prop.prop_id] = new_prop
|
92 |
-
else: print("Skipping linking due to import error.")
|
93 |
-
print(f"Phase 1 (Extract(Era), Validate, Link(Era)) complete. KB size: {len(knowledge_base)}")
|
94 |
-
|
95 |
-
# 1.5 Adım: Bias Detection (v3)
|
96 |
-
print("\nPhase 1.5: Running Bias Detection Heuristics...")
|
97 |
-
if run_bias_detection_v3 and knowledge_base: run_bias_detection_v3(knowledge_base)
|
98 |
-
else: print("Skipping Bias Detection due to import error or empty KB.")
|
99 |
-
print("Phase 1.5 complete.")
|
100 |
-
|
101 |
-
# 2. Adım: Update (Era Mantığı ile)
|
102 |
-
print("\nPhase 2: Running Era Updates (Reliability, Cycle Detect, Plausibility-aware Confidence)...")
|
103 |
-
if run_updates_era: updated_knowledge_base = run_updates_era(knowledge_base) # ERA Updater
|
104 |
-
else: print("Skipping Updates due to import error."); updated_knowledge_base = knowledge_base
|
105 |
-
print("Phase 2 complete.")
|
106 |
-
|
107 |
-
end_time = time.time(); print(f"\nPipeline finished in {end_time - start_time:.2f} seconds.")
|
108 |
-
return updated_knowledge_base
|
109 |
-
|
110 |
-
# --- Ana Çalışma Bloğu ---
|
111 |
-
if __name__ == "__main__":
|
112 |
-
# Era sürümünün tüm yeteneklerini test edecek örnek girdiler
|
113 |
-
sample_inputs_era_final = [
|
114 |
-
{
|
115 |
-
"source_id": "fact_sheet_1", "source_type": "fact",
|
116 |
-
"text": "Water is H2O. The sun is hot. Ice is cold." # Yüksek plausibility, basit zıtlık
|
117 |
-
},
|
118 |
-
{
|
119 |
-
"source_id": "opinion_blog_A", "source_type": "blog",
|
120 |
-
"text": "Maybe the new policy is good. It could improve things. Perhaps." # Düşük başlangıç güveni (linguistic)
|
121 |
-
},
|
122 |
-
{
|
123 |
-
"source_id": "opinion_blog_B", "source_type": "blog",
|
124 |
-
"text": "The new policy is definitely bad! It will undoubtedly harm the economy. It is not good." # Yüksek başlangıç güveni (linguistic) + Zıtlık (good/bad)
|
125 |
-
},
|
126 |
-
{
|
127 |
-
"source_id": "report_X", "source_type": "report",
|
128 |
-
"text": "System Alpha is bigger than System Beta. System Beta is not small compared to Alpha." # İlişkisel çelişki?
|
129 |
-
},
|
130 |
-
{
|
131 |
-
"source_id": "another_report", "source_type": "report",
|
132 |
-
"text": "System Alpha is large." # 'bigger' ile eşanlamlı? (Synonym desteği için)
|
133 |
-
},
|
134 |
-
{ # Döngü + Plausibility düşük + Kaynak Tekelciliği
|
135 |
-
"source_id": "conspiracy_theory.blog", "source_type": "blog",
|
136 |
-
"text": "The moon landing was faked because the photos look wrong. The photos look wrong because the shadows are incorrect. The shadows are incorrect because the landing was faked."
|
137 |
-
# Extractor muhtemelen bunları çıkaramaz, ama bias/cycle test için dursun.
|
138 |
-
# Ekstra düşük plausibility testi:
|
139 |
-
"Also, the moon is made of cheese."
|
140 |
-
}
|
141 |
-
]
|
142 |
-
|
143 |
-
# İşlem hattını çalıştır
|
144 |
-
final_kb_era = run_aee_era_pipeline(sample_inputs_era_final)
|
145 |
-
|
146 |
-
# Genel KB Raporunu yazdır
|
147 |
-
report_kb_era(final_kb_era)
|
148 |
-
|
149 |
-
# Örnek Açıklamaları Üret ve Yazdır
|
150 |
-
print("\n" + "#"*70)
|
151 |
-
print(" AEE Era Version - Generating Explanations")
|
152 |
-
print("#"*70)
|
153 |
-
if final_kb_era and generate_explanation_era:
|
154 |
-
ids_to_explain = list(final_kb_era.keys())
|
155 |
-
print(f"\nGenerating explanations for all {len(ids_to_explain)} propositions...\n")
|
156 |
-
for prop_id in ids_to_explain:
|
157 |
-
explanation = generate_explanation_era(prop_id, final_kb_era) # ERA Explainer
|
158 |
-
print(explanation)
|
159 |
-
print("-" * 40)
|
160 |
-
else: print("Knowledge Base is empty or Explainer not available.")
|
161 |
-
print("\n" + "#"*70); print(" Explanation generation step complete."); print("#"*70)
|
162 |
-
|
163 |
-
# PROJE KODLAMASI TAMAMLANDI MESAJI
|
164 |
-
print("\n###########################################################################")
|
165 |
-
print("# AEE ERA VERSION - ALL PLANNED CORE FEATURE CODING COMPLETE!")
|
166 |
-
print("# All modules updated to Era versions where planned.")
|
167 |
-
print("# Project includes: Extraction(Era.2a), Validation(Era.1), Linking(Era.2b),")
|
168 |
-
print("# Bias Detection(v3), Updates(Era.1d), Explanation(Era.1e).")
|
169 |
-
print("#")
|
170 |
-
print("# FINAL STEP (FOR YOU): TESTING & EVALUATION!")
|
171 |
-
print("# - Run this script: python aee_era_main.py")
|
172 |
-
print("# - Examine the report and explanations thoroughly.")
|
173 |
-
print("# - Check if initial confidence reflects modality.")
|
174 |
-
print("# - Check if more links (support/contradiction) are found.")
|
175 |
-
print("# - Check bias flags, plausibility, final confidence.")
|
176 |
-
print("# - Try your own texts!")
|
177 |
-
print("# - Provide your final feedback and evaluation.")
|
178 |
-
print("###########################################################################")
|
|
|
1 |
+
# aee_era_main.py
|
2 |
+
# AEE Era Sürümü İşlem Hattını Çalıştıran Ana Script
|
3 |
+
# Era Extractor ve Linker entegre edildi. (Era Adım 2 Tamamlandı - Proje Kodu Bitti!)
|
4 |
+
|
5 |
+
import time
|
6 |
+
from typing import Dict, List, Optional, Any
|
7 |
+
|
8 |
+
# Era sürümü klasöründeki TÜM modülleri import et
|
9 |
+
try:
|
10 |
+
from aee_core_classes_era import Proposition, EpistemicData
|
11 |
+
from aee_extractor_era import process_with_spacy, extract_propositions_era, NLP_MODEL # Era Extractor
|
12 |
+
from aee_linker_era import find_and_link_evidence_era # Era Linker
|
13 |
+
from aee_updater_era import run_updates_era # Era Updater
|
14 |
+
from aee_explainer_era import generate_explanation_era # Era Explainer
|
15 |
+
from aee_bias_detector import run_bias_detection_v3 # v3 Bias Detector
|
16 |
+
from aee_validator import check_plausibility_v_era # Era Validator
|
17 |
+
from aee_utils import get_proposition_by_id # Utils
|
18 |
+
except ImportError as e:
|
19 |
+
print(f"Fatal Error: Could not import necessary modules. Check file paths and dependencies in AEE/Era folder.")
|
20 |
+
print(f"Import Error: {e}")
|
21 |
+
exit()
|
22 |
+
|
23 |
+
# --- Raporlama Fonksiyonu (Era) ---
|
24 |
+
def report_kb_era(kb: Dict[str, Proposition]):
|
25 |
+
# ... (Öncekiyle aynı - değişiklik yok) ...
|
26 |
+
print("\n" + "="*70); print(" AEE Era Version - Knowledge Base Report (Final Status)"); print("="*70)
|
27 |
+
if not kb: print("Knowledge Base is empty."); print("="*70); return
|
28 |
+
print(f"Total propositions in KB: {len(kb)}"); print("-"*70)
|
29 |
+
propositions_by_source: Dict[str, List[Proposition]] = {};
|
30 |
+
def sort_key(prop): conf = prop.epistemic_data.computed_confidence; return conf if conf is not None else -1.0
|
31 |
+
sorted_props = sorted(list(kb.values()), key=sort_key, reverse=True)
|
32 |
+
for prop in sorted_props: source = prop.epistemic_data.source_id; propositions_by_source.setdefault(source, []).append(prop)
|
33 |
+
for source_id in sorted(propositions_by_source.keys()):
|
34 |
+
props = propositions_by_source[source_id]; source_reliability = getattr(props[0].epistemic_data, 'reliability_score', None)
|
35 |
+
reliability_str = f"{source_reliability:.2f}" if source_reliability is not None else "N/A"
|
36 |
+
print(f"\n--- Source: {source_id} (Calculated Reliability: {reliability_str}) ---")
|
37 |
+
for prop in props:
|
38 |
+
neg_str = "[NEGATED] " if prop.is_negated else ""
|
39 |
+
supports_str = ', '.join([pid[:8] for pid in prop.epistemic_data.supports]) if prop.epistemic_data.supports else "None"
|
40 |
+
contradicts_str = ', '.join([pid[:8] for pid in prop.epistemic_data.contradicts]) if prop.epistemic_data.contradicts else "None"
|
41 |
+
bias_str = ', '.join(prop.epistemic_data.bias_flags) if prop.epistemic_data.bias_flags else "None"
|
42 |
+
plausibility_score = prop.epistemic_data.plausibility_score; plausibility_str = f"{plausibility_score:.2f}" if plausibility_score is not None else "N/A"
|
43 |
+
validation_notes_str = ', '.join(prop.epistemic_data.validation_notes) if prop.epistemic_data.validation_notes else "None"
|
44 |
+
conf_score = prop.epistemic_data.computed_confidence; conf_str = f"{conf_score:.3f}" if conf_score is not None else "N/A"
|
45 |
+
init_conf_score = prop.epistemic_data.initial_confidence; init_conf_str = f"{init_conf_score:.2f}" if init_conf_score is not None else "N/A"
|
46 |
+
print(f" Prop ID : {prop.prop_id}")
|
47 |
+
print(f" Struct: {neg_str}{prop.subject_lemma} - {prop.relation_lemma} - {prop.value_lemma}")
|
48 |
+
print(f" Conf. : {conf_str} (Initial: {init_conf_str})") # Initial conf'un değiştiğini göreceğiz
|
49 |
+
print(f" Links : Supports: [{supports_str}] | Contradicts: [{contradicts_str}]")
|
50 |
+
print(f" Biases: [{bias_str}]")
|
51 |
+
print(f" Plaus.: {plausibility_str} | Notes: [{validation_notes_str}]")
|
52 |
+
print("\n" + "="*70); print(" End of KB Report "); print("="*70)
|
53 |
+
|
54 |
+
|
55 |
+
# --- Ana İşlem Fonksiyonu (Era - Final) ---
|
56 |
+
def run_aee_era_pipeline(inputs: List[Dict[str, str]]) -> Dict[str, Proposition]:
|
57 |
+
"""
|
58 |
+
Verilen girdiler için AEE Era işlem hattını tam olarak çalıştırır
|
59 |
+
(Era Extract, Plausibility Check, Era Linker, Bias Detect, Era Update).
|
60 |
+
"""
|
61 |
+
if NLP_MODEL is None: print("FATAL ERROR: spaCy model not loaded."); return {}
|
62 |
+
|
63 |
+
print("\nStarting AEE Era Final Pipeline...")
|
64 |
+
knowledge_base: Dict[str, Proposition] = {}
|
65 |
+
start_time = time.time()
|
66 |
+
|
67 |
+
# 1. Adım: Extract (Era) & Validate Plausibility & Link (Era)
|
68 |
+
print("Phase 1: Extracting(Era), Validating Plausibility, and Linking(Era)...")
|
69 |
+
all_extracted_props_before_linking: List[Proposition] = []
|
70 |
+
for item in inputs:
|
71 |
+
source_id = item.get("source_id", f"unknown_source_{int(time.time())}"); text = item.get("text", "")
|
72 |
+
if not text: continue
|
73 |
+
doc = process_with_spacy(text)
|
74 |
+
if doc:
|
75 |
+
# ERA EXTRACTOR ÇAĞIRILIYOR
|
76 |
+
extracted_props = extract_propositions_era(doc, source_id)
|
77 |
+
for prop in extracted_props:
|
78 |
+
plausibility_score, validation_notes = check_plausibility_v_era(prop)
|
79 |
+
if hasattr(prop, 'epistemic_data') and prop.epistemic_data:
|
80 |
+
prop.epistemic_data.plausibility_score = plausibility_score
|
81 |
+
if validation_notes: prop.epistemic_data.validation_notes.extend(validation_notes)
|
82 |
+
all_extracted_props_before_linking.append(prop)
|
83 |
+
print(f" Phase 1a (Extraction(Era) & Validation) complete. Total extracted: {len(all_extracted_props_before_linking)}")
|
84 |
+
|
85 |
+
print(" Phase 1b (Linking(Era))...")
|
86 |
+
if find_and_link_evidence_era: # Era linker fonksiyonu
|
87 |
+
for new_prop in all_extracted_props_before_linking:
|
88 |
+
if new_prop.prop_id not in knowledge_base:
|
89 |
+
# ERA LINKER ÇAĞIRILIYOR
|
90 |
+
find_and_link_evidence_era(new_prop, knowledge_base)
|
91 |
+
knowledge_base[new_prop.prop_id] = new_prop
|
92 |
+
else: print("Skipping linking due to import error.")
|
93 |
+
print(f"Phase 1 (Extract(Era), Validate, Link(Era)) complete. KB size: {len(knowledge_base)}")
|
94 |
+
|
95 |
+
# 1.5 Adım: Bias Detection (v3)
|
96 |
+
print("\nPhase 1.5: Running Bias Detection Heuristics...")
|
97 |
+
if run_bias_detection_v3 and knowledge_base: run_bias_detection_v3(knowledge_base)
|
98 |
+
else: print("Skipping Bias Detection due to import error or empty KB.")
|
99 |
+
print("Phase 1.5 complete.")
|
100 |
+
|
101 |
+
# 2. Adım: Update (Era Mantığı ile)
|
102 |
+
print("\nPhase 2: Running Era Updates (Reliability, Cycle Detect, Plausibility-aware Confidence)...")
|
103 |
+
if run_updates_era: updated_knowledge_base = run_updates_era(knowledge_base) # ERA Updater
|
104 |
+
else: print("Skipping Updates due to import error."); updated_knowledge_base = knowledge_base
|
105 |
+
print("Phase 2 complete.")
|
106 |
+
|
107 |
+
end_time = time.time(); print(f"\nPipeline finished in {end_time - start_time:.2f} seconds.")
|
108 |
+
return updated_knowledge_base
|
109 |
+
|
110 |
+
# --- Ana Çalışma Bloğu ---
|
111 |
+
if __name__ == "__main__":
|
112 |
+
# Era sürümünün tüm yeteneklerini test edecek örnek girdiler
|
113 |
+
sample_inputs_era_final = [
|
114 |
+
{
|
115 |
+
"source_id": "fact_sheet_1", "source_type": "fact",
|
116 |
+
"text": "Water is H2O. The sun is hot. Ice is cold." # Yüksek plausibility, basit zıtlık
|
117 |
+
},
|
118 |
+
{
|
119 |
+
"source_id": "opinion_blog_A", "source_type": "blog",
|
120 |
+
"text": "Maybe the new policy is good. It could improve things. Perhaps." # Düşük başlangıç güveni (linguistic)
|
121 |
+
},
|
122 |
+
{
|
123 |
+
"source_id": "opinion_blog_B", "source_type": "blog",
|
124 |
+
"text": "The new policy is definitely bad! It will undoubtedly harm the economy. It is not good." # Yüksek başlangıç güveni (linguistic) + Zıtlık (good/bad)
|
125 |
+
},
|
126 |
+
{
|
127 |
+
"source_id": "report_X", "source_type": "report",
|
128 |
+
"text": "System Alpha is bigger than System Beta. System Beta is not small compared to Alpha." # İlişkisel çelişki?
|
129 |
+
},
|
130 |
+
{
|
131 |
+
"source_id": "another_report", "source_type": "report",
|
132 |
+
"text": "System Alpha is large." # 'bigger' ile eşanlamlı? (Synonym desteği için)
|
133 |
+
},
|
134 |
+
{ # Döngü + Plausibility düşük + Kaynak Tekelciliği
|
135 |
+
"source_id": "conspiracy_theory.blog", "source_type": "blog",
|
136 |
+
"text": "The moon landing was faked because the photos look wrong. The photos look wrong because the shadows are incorrect. The shadows are incorrect because the landing was faked."
|
137 |
+
# Extractor muhtemelen bunları çıkaramaz, ama bias/cycle test için dursun.
|
138 |
+
# Ekstra düşük plausibility testi:
|
139 |
+
"Also, the moon is made of cheese."
|
140 |
+
}
|
141 |
+
]
|
142 |
+
|
143 |
+
# İşlem hattını çalıştır
|
144 |
+
final_kb_era = run_aee_era_pipeline(sample_inputs_era_final)
|
145 |
+
|
146 |
+
# Genel KB Raporunu yazdır
|
147 |
+
report_kb_era(final_kb_era)
|
148 |
+
|
149 |
+
# Örnek Açıklamaları Üret ve Yazdır
|
150 |
+
print("\n" + "#"*70)
|
151 |
+
print(" AEE Era Version - Generating Explanations")
|
152 |
+
print("#"*70)
|
153 |
+
if final_kb_era and generate_explanation_era:
|
154 |
+
ids_to_explain = list(final_kb_era.keys())
|
155 |
+
print(f"\nGenerating explanations for all {len(ids_to_explain)} propositions...\n")
|
156 |
+
for prop_id in ids_to_explain:
|
157 |
+
explanation = generate_explanation_era(prop_id, final_kb_era) # ERA Explainer
|
158 |
+
print(explanation)
|
159 |
+
print("-" * 40)
|
160 |
+
else: print("Knowledge Base is empty or Explainer not available.")
|
161 |
+
print("\n" + "#"*70); print(" Explanation generation step complete."); print("#"*70)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|