neuralworm commited on
Commit
c52408e
·
verified ·
1 Parent(s): a49d431

Update analyze_verses_universal.py

Browse files
Files changed (1) hide show
  1. analyze_verses_universal.py +29 -31
analyze_verses_universal.py CHANGED
@@ -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 isolierter Bitplane-Tiefe {args.xor_depth}...")
56
  print("\n" + "="*20 + f" ORAKEL-ANTWORTEN FÜR '{args.query}' " + "="*20)
57
 
58
  verses_processed = 0
@@ -77,20 +77,22 @@ def main(args):
77
 
78
  power_result = get_power_result(verse_sum, query_value)
79
 
80
- header_printed = False
 
 
81
 
 
 
 
 
 
 
 
 
 
82
  def print_matches(matches, title, calculation_str):
83
- nonlocal header_printed, resonance_count
84
  if not matches: return
85
 
86
- if not header_printed:
87
- resonance_count += 1
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)
95
  matches_to_show = matches[:args.results_per_verse]
96
 
@@ -108,39 +110,35 @@ def main(args):
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)
 
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-Variationstiefe {args.xor_depth}...")
56
  print("\n" + "="*20 + f" ORAKEL-ANTWORTEN FÜR '{args.query}' " + "="*20)
57
 
58
  verses_processed = 0
 
77
 
78
  power_result = get_power_result(verse_sum, query_value)
79
 
80
+ # Zuerst das Haupt-Ergebnis berechnen
81
+ main_target_sum = verse_sum ^ power_result
82
+ main_matches = find_all_matching_phrases(main_target_sum, phrase_dictionary)
83
 
84
+ # Nur fortfahren, wenn die Haupt-Resonanz existiert
85
+ if not main_matches:
86
+ continue
87
+
88
+ resonance_count += 1
89
+ verse_ref = f"B{book_num:02d}, K{chap_idx}, V{verse_idx}"
90
+ print(f"\n--- Resonanz #{resonance_count} in [{verse_ref}] (G_sum:{verse_sum}) ---")
91
+ print(f"Originalvers: {verse_text.strip()}")
92
+
93
  def print_matches(matches, title, calculation_str):
 
94
  if not matches: return
95
 
 
 
 
 
 
 
 
 
96
  matches.sort(key=lambda p: (p.get('freq', 0) / p.get('words', 99)), reverse=True)
97
  matches_to_show = matches[:args.results_per_verse]
98
 
 
110
  if translation_str:
111
  print(f" ↳ Interpretation: \"{translation_str}\"")
112
 
113
+ # 1. Die Haupt-Resonanz anzeigen
114
+ calc_str = f"[{verse_sum}] ^ [{power_result}] → [G_ziel:{main_target_sum}]"
115
+ print_matches(main_matches, "Haupt-Resonanz", calc_str)
 
 
116
 
117
+ # 2. Die Bitplane-Variationen des ERGEBNISSES anzeigen
118
+ if args.xor_depth > 0:
119
+ print(f" [INFO] Bitplane-Variationen des Ergebnisses ({main_target_sum}):")
120
  for depth in range(args.xor_depth):
121
+ bit_flip = 1 << depth
122
 
123
+ # Flippe das Bit 'd' im Hauptergebnis
124
+ target_sum = main_target_sum ^ bit_flip
125
 
126
+ bitplane_matches = find_all_matching_phrases(target_sum, phrase_dictionary)
127
 
128
+ if bitplane_matches:
129
+ bitplane_calc_str = f"[{main_target_sum}] ^ [Bit {depth}] → [G_ziel:{target_sum}]"
130
+ print_matches(bitplane_matches, f"Variation (Tiefe {depth})", bitplane_calc_str)
 
 
 
131
 
132
  except FileNotFoundError: continue
133
 
134
  logging.info(f"Analyse abgeschlossen. {resonance_count} Resonanz-Verse in {verses_processed} analysierten Versen gefunden.")
135
 
136
  if __name__ == "__main__":
137
+ parser = argparse.ArgumentParser(description="Tanakh Universal Resonance Analyzer mit Bitplane-Variationen.")
138
  parser.add_argument("query", type=str, help="Die Abfragephrase (z.B. 'יהוה').")
139
  parser.add_argument("--translate", action="store_true", help="Aktiviert die automatische Übersetzung.")
140
  parser.add_argument("--process-verses", type=int, help="Maximale Anzahl der zu analysierenden Start-Verse.")
141
+ parser.add_argument("--results-per-verse", type=int, default=3, help="Maximale Orakel-Antworten pro Resonanz-Typ (Standard: 3).")
142
+ parser.add_argument("--xor-depth", type=int, default=16, help="Maximale Tiefe für Bitplane-Variationen des Ergebnisses (0-15) (Standard: 16).")
143
  args = parser.parse_args()
144
  main(args)