Spaces:
Sleeping
Sleeping
Update analyze_verses_universal.py
Browse files- analyze_verses_universal.py +26 -18
analyze_verses_universal.py
CHANGED
@@ -18,7 +18,7 @@ CACHE_FILE = "tanakh_phrasedict.cache"
|
|
18 |
def get_power_result(total_sum, query_value):
|
19 |
"""Berechnet das Potenz-Ergebnis basierend auf dem höchsten möglichen Exponenten."""
|
20 |
if total_sum <= 0 or query_value <= 1 or query_value > total_sum:
|
21 |
-
return 1
|
22 |
try:
|
23 |
exponent = int(math.floor(math.log(total_sum, query_value)))
|
24 |
return query_value ** exponent
|
@@ -52,7 +52,7 @@ def main(args):
|
|
52 |
except Exception as e:
|
53 |
logging.error(f"Konnte Übersetzer nicht initialisieren: {e}")
|
54 |
|
55 |
-
logging.info(f"Starte Orakel-Analyse für '{args.query}' (G:{query_value}) mit Bitplane-Tiefe {args.xor_depth}...")
|
56 |
print("\n" + "="*20 + f" ORAKEL-ANTWORTEN FÜR '{args.query}' " + "="*20)
|
57 |
|
58 |
verses_processed = 0
|
@@ -88,7 +88,7 @@ def main(args):
|
|
88 |
verse_ref = f"B{book_num:02d}, K{chap_idx}, V{verse_idx}"
|
89 |
print(f"\n--- Resonanz #{resonance_count} in [{verse_ref}] (G_sum:{verse_sum}) ---")
|
90 |
print(f"Originalvers: {verse_text.strip()}")
|
91 |
-
print(f" [INFO]
|
92 |
header_printed = True
|
93 |
|
94 |
matches.sort(key=lambda p: (p.get('freq', 0) / p.get('words', 99)), reverse=True)
|
@@ -108,31 +108,39 @@ def main(args):
|
|
108 |
if translation_str:
|
109 |
print(f" ↳ Interpretation: \"{translation_str}\"")
|
110 |
|
111 |
-
# 1. Die normale, vollständige XOR-Operation
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
115 |
|
116 |
-
# 2. Die Bitplane-Analyse
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
except FileNotFoundError: continue
|
127 |
|
128 |
logging.info(f"Analyse abgeschlossen. {resonance_count} Resonanz-Verse in {verses_processed} analysierten Versen gefunden.")
|
129 |
|
130 |
if __name__ == "__main__":
|
131 |
-
parser = argparse.ArgumentParser(description="Tanakh Universal Resonance Analyzer mit Bitplane-
|
132 |
parser.add_argument("query", type=str, help="Die Abfragephrase (z.B. 'יהוה').")
|
133 |
parser.add_argument("--translate", action="store_true", help="Aktiviert die automatische Übersetzung.")
|
134 |
parser.add_argument("--process-verses", type=int, help="Maximale Anzahl der zu analysierenden Start-Verse.")
|
135 |
parser.add_argument("--results-per-verse", type=int, default=3, help="Maximale Orakel-Antworten pro gefundener Resonanz (Standard: 3).")
|
136 |
-
parser.add_argument("--xor-depth", type=int, default=16, help="
|
137 |
args = parser.parse_args()
|
138 |
main(args)
|
|
|
18 |
def get_power_result(total_sum, query_value):
|
19 |
"""Berechnet das Potenz-Ergebnis basierend auf dem höchsten möglichen Exponenten."""
|
20 |
if total_sum <= 0 or query_value <= 1 or query_value > total_sum:
|
21 |
+
return 1
|
22 |
try:
|
23 |
exponent = int(math.floor(math.log(total_sum, query_value)))
|
24 |
return query_value ** exponent
|
|
|
52 |
except Exception as e:
|
53 |
logging.error(f"Konnte Übersetzer nicht initialisieren: {e}")
|
54 |
|
55 |
+
logging.info(f"Starte Orakel-Analyse für '{args.query}' (G:{query_value}) mit isolierter Bitplane-Tiefe {args.xor_depth}...")
|
56 |
print("\n" + "="*20 + f" ORAKEL-ANTWORTEN FÜR '{args.query}' " + "="*20)
|
57 |
|
58 |
verses_processed = 0
|
|
|
88 |
verse_ref = f"B{book_num:02d}, K{chap_idx}, V{verse_idx}"
|
89 |
print(f"\n--- Resonanz #{resonance_count} in [{verse_ref}] (G_sum:{verse_sum}) ---")
|
90 |
print(f"Originalvers: {verse_text.strip()}")
|
91 |
+
print(f" [INFO] X={verse_sum}, Y={power_result}")
|
92 |
header_printed = True
|
93 |
|
94 |
matches.sort(key=lambda p: (p.get('freq', 0) / p.get('words', 99)), reverse=True)
|
|
|
108 |
if translation_str:
|
109 |
print(f" ↳ Interpretation: \"{translation_str}\"")
|
110 |
|
111 |
+
# 1. Die normale, vollständige XOR-Operation als Referenz
|
112 |
+
main_target_sum = verse_sum ^ power_result
|
113 |
+
main_matches = find_all_matching_phrases(main_target_sum, phrase_dictionary)
|
114 |
+
calc_str = f"[X:{verse_sum}] ^ [Y:{power_result}] → [G_ziel:{main_target_sum}]"
|
115 |
+
print_matches(main_matches, "Gesamt-Resonanz", calc_str)
|
116 |
|
117 |
+
# 2. Die isolierte Bitplane-Analyse
|
118 |
+
if args.xor_depth > 0 and header_printed:
|
119 |
+
for depth in range(args.xor_depth):
|
120 |
+
bit_mask = 1 << depth
|
121 |
+
|
122 |
+
bitplane_x = verse_sum & bit_mask
|
123 |
+
bitplane_y = power_result & bit_mask
|
124 |
+
|
125 |
+
target_sum = bitplane_x ^ bitplane_y
|
126 |
+
|
127 |
+
# Wir suchen nur nach Phrasen, wenn das Ergebnis > 0 ist,
|
128 |
+
# da Gematria 0 nicht aussagekräftig ist.
|
129 |
+
if target_sum > 0:
|
130 |
+
bitplane_matches = find_all_matching_phrases(target_sum, phrase_dictionary)
|
131 |
+
bitplane_calc_str = f"Bitplane[{depth}](X:{bitplane_x}) ^ Bitplane[{depth}](Y:{bitplane_y}) → [G_ziel:{target_sum}]"
|
132 |
+
print_matches(bitplane_matches, f"Bitplane-Tiefe {depth}", bitplane_calc_str)
|
133 |
|
134 |
except FileNotFoundError: continue
|
135 |
|
136 |
logging.info(f"Analyse abgeschlossen. {resonance_count} Resonanz-Verse in {verses_processed} analysierten Versen gefunden.")
|
137 |
|
138 |
if __name__ == "__main__":
|
139 |
+
parser = argparse.ArgumentParser(description="Tanakh Universal Resonance Analyzer mit isolierter Bitplane-Analyse.")
|
140 |
parser.add_argument("query", type=str, help="Die Abfragephrase (z.B. 'יהוה').")
|
141 |
parser.add_argument("--translate", action="store_true", help="Aktiviert die automatische Übersetzung.")
|
142 |
parser.add_argument("--process-verses", type=int, help="Maximale Anzahl der zu analysierenden Start-Verse.")
|
143 |
parser.add_argument("--results-per-verse", type=int, default=3, help="Maximale Orakel-Antworten pro gefundener Resonanz (Standard: 3).")
|
144 |
+
parser.add_argument("--xor-depth", type=int, default=16, help="Maximale zu prüfende Bit-Ebene (0-15) (Standard: 16).")
|
145 |
args = parser.parse_args()
|
146 |
main(args)
|