Spaces:
Sleeping
Sleeping
Commit
·
f35e60a
1
Parent(s):
4db2f42
fix tab 4
Browse files- app.py +318 -64
- gematria.py +3 -3
app.py
CHANGED
@@ -2,7 +2,7 @@ import logging
|
|
2 |
import os
|
3 |
|
4 |
logger = logging.getLogger(__name__)
|
5 |
-
logging.basicConfig(level=logging.
|
6 |
|
7 |
import gradio as gr
|
8 |
import torah
|
@@ -721,6 +721,9 @@ with gr.Blocks() as app:
|
|
721 |
include_tripitaka_chk_els = gr.Checkbox(label="Include Tripitaka", value=False)
|
722 |
with gr.Row():
|
723 |
translate_results_chk_els = gr.Checkbox(label="Translate Results to English", value=False)
|
|
|
|
|
|
|
724 |
|
725 |
with gr.Row():
|
726 |
perform_search_btn_els = gr.Button("Perform Search")
|
@@ -741,7 +744,177 @@ with gr.Blocks() as app:
|
|
741 |
)
|
742 |
|
743 |
# Hauptfunktion für den vierten Tab
|
744 |
-
def perform_date_range_els_search(start_date, end_date, names_input, search_type, search_term, gematria_sum_search, search_mode, include_torah, include_bible, include_quran, include_hindu, include_tripitaka, translate_results):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
745 |
names = [n.strip() for n in names_input.split("\n") if n.strip()]
|
746 |
date_gematrias = perform_gematria_calculation_for_date_range(start_date, end_date)
|
747 |
|
@@ -762,67 +935,54 @@ with gr.Blocks() as app:
|
|
762 |
for intermediate_result in intermediate_results:
|
763 |
date_str = intermediate_result["date"]
|
764 |
name = intermediate_result["name"]
|
765 |
-
|
766 |
-
|
767 |
-
#
|
768 |
-
|
769 |
-
|
770 |
-
rounds_combination="1,-1",
|
771 |
-
tlang="english",
|
772 |
-
strip_spaces=True,
|
773 |
-
strip_in_braces=True,
|
774 |
-
strip_diacritics_chk=True,
|
775 |
-
include_torah=include_torah,
|
776 |
-
include_bible=include_bible,
|
777 |
-
include_quran=include_quran,
|
778 |
-
include_hindu=include_hindu,
|
779 |
-
include_tripitaka=include_tripitaka
|
780 |
)
|
781 |
|
782 |
-
#
|
783 |
-
|
784 |
-
|
785 |
-
|
786 |
-
|
787 |
-
|
788 |
-
|
789 |
-
|
790 |
-
|
791 |
-
|
792 |
-
|
793 |
-
|
794 |
-
|
795 |
-
|
796 |
-
|
797 |
-
|
798 |
-
|
799 |
-
|
800 |
-
|
801 |
-
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
808 |
-
|
809 |
-
|
810 |
-
|
811 |
-
|
812 |
-
|
813 |
-
|
814 |
-
|
815 |
-
|
816 |
-
|
817 |
-
|
818 |
-
|
819 |
-
|
820 |
-
|
821 |
-
|
822 |
-
|
823 |
-
except KeyError as e:
|
824 |
-
logger.error(f"KeyError - Key '{e.args[0]}' not found in result. Skipping this result.")
|
825 |
-
continue
|
826 |
|
827 |
# Übersetzung der Ergebnisse, falls angefordert
|
828 |
if translate_results:
|
@@ -830,19 +990,113 @@ with gr.Blocks() as app:
|
|
830 |
try:
|
831 |
text_to_translate = result_entry["result"]["result_text"]
|
832 |
source_lang = result_entry["result"].get("source_language", "auto")
|
833 |
-
translated_text = translation_utils.get_translation(text_to_translate, "en", source_lang)
|
834 |
-
result_entry["result"]["translated_text"] = translated_text
|
835 |
except KeyError as e:
|
836 |
logger.error(f"KeyError translating result_text: {e}")
|
837 |
|
838 |
return all_results
|
839 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
840 |
perform_search_btn_els.click(
|
841 |
perform_date_range_els_search,
|
842 |
-
inputs=[start_date_els, end_date_els, names_input_els, search_type_els, search_term_els, gematria_sum_search_els, search_mode_els, include_torah_chk_els, include_bible_chk_els, include_quran_chk_els, include_hindu_chk_els, include_tripitaka_chk_els, translate_results_chk_els],
|
843 |
outputs=[filtered_results_output_els]
|
844 |
)
|
845 |
|
|
|
|
|
846 |
# --- Event Handlers ---
|
847 |
|
848 |
search_type.change(
|
|
|
2 |
import os
|
3 |
|
4 |
logger = logging.getLogger(__name__)
|
5 |
+
logging.basicConfig(level=logging.DEBUG)
|
6 |
|
7 |
import gradio as gr
|
8 |
import torah
|
|
|
721 |
include_tripitaka_chk_els = gr.Checkbox(label="Include Tripitaka", value=False)
|
722 |
with gr.Row():
|
723 |
translate_results_chk_els = gr.Checkbox(label="Translate Results to English", value=False)
|
724 |
+
with gr.Row():
|
725 |
+
sub_oscillation_search_chk_els = gr.Checkbox(label="Search in Sub-Oscillations", value=False) # Neue Checkbox
|
726 |
+
sub_oscillation_level_els = gr.Number(label="Sub-Oscillation Level (0 = off)", precision=0, value=1)
|
727 |
|
728 |
with gr.Row():
|
729 |
perform_search_btn_els = gr.Button("Perform Search")
|
|
|
744 |
)
|
745 |
|
746 |
# Hauptfunktion für den vierten Tab
|
747 |
+
def perform_date_range_els_search(start_date, end_date, names_input, search_type, search_term, gematria_sum_search, search_mode, include_torah, include_bible, include_quran, include_hindu, include_tripitaka, translate_results, sub_oscillation_search, sub_oscillation_level):
|
748 |
+
names = [n.strip() for n in names_input.split("\n") if n.strip()]
|
749 |
+
date_gematrias = perform_gematria_calculation_for_date_range(start_date, end_date)
|
750 |
+
search_term = strip_diacritics(search_term)
|
751 |
+
# Zwischenergebnisse mit Datum, Namen und Gematria-Summe speichern
|
752 |
+
intermediate_results = []
|
753 |
+
for date_str, date_data in date_gematrias.items():
|
754 |
+
for name in names:
|
755 |
+
name_gematria = calculate_gematria_sum(name, "")
|
756 |
+
combined_gematria_sum = date_data["date_gematria"] + name_gematria
|
757 |
+
intermediate_results.append(
|
758 |
+
{"date": date_str, "name": name, "gematria_sum": combined_gematria_sum}
|
759 |
+
)
|
760 |
+
|
761 |
+
# Ergebnisse nach Datum sortieren
|
762 |
+
intermediate_results.sort(key=lambda x: x["date"])
|
763 |
+
|
764 |
+
all_results = []
|
765 |
+
for intermediate_result in intermediate_results:
|
766 |
+
date_str = intermediate_result["date"]
|
767 |
+
name = intermediate_result["name"]
|
768 |
+
initial_gematria_sum = intermediate_result["gematria_sum"]
|
769 |
+
|
770 |
+
# Basis-Suche durchführen
|
771 |
+
base_results = perform_els_search_for_gematria_sum(
|
772 |
+
initial_gematria_sum, include_torah, include_bible, include_quran, include_hindu, include_tripitaka
|
773 |
+
)
|
774 |
+
|
775 |
+
# Nur ausgewählte Bücher für die Sub-Oszillationen-Suche berücksichtigen
|
776 |
+
selected_books_results = {}
|
777 |
+
if include_torah:
|
778 |
+
selected_books_results["Torah"] = base_results.get("Torah", [])
|
779 |
+
if include_bible:
|
780 |
+
selected_books_results["Bible"] = base_results.get("Bible", [])
|
781 |
+
if include_quran:
|
782 |
+
selected_books_results["Quran"] = base_results.get("Quran", [])
|
783 |
+
if include_hindu:
|
784 |
+
selected_books_results["Rig Veda"] = base_results.get("Rig Veda", [])
|
785 |
+
if include_tripitaka:
|
786 |
+
selected_books_results["Tripitaka"] = base_results.get("Tripitaka", [])
|
787 |
+
|
788 |
+
# Speichere die base_results in einer Liste
|
789 |
+
base_results_list = []
|
790 |
+
for book_name, book_results in selected_books_results.items():
|
791 |
+
for result in book_results:
|
792 |
+
base_results_list.append({'book': book_name, 'result': result})
|
793 |
+
|
794 |
+
# Sub-Oszillationen-Suche, falls aktiviert und Level > 0
|
795 |
+
if sub_oscillation_search and sub_oscillation_level > 0:
|
796 |
+
base_results_list = perform_sub_oscillation_search(
|
797 |
+
base_results_list, initial_gematria_sum, sub_oscillation_level,
|
798 |
+
include_torah, include_bible, include_quran, include_hindu, include_tripitaka
|
799 |
+
)
|
800 |
+
|
801 |
+
# Umwandlung der erweiterten base_results_list in base_results
|
802 |
+
base_results = {}
|
803 |
+
for result_entry in base_results_list:
|
804 |
+
book_name = result_entry['book']
|
805 |
+
if book_name not in base_results:
|
806 |
+
base_results[book_name] = []
|
807 |
+
base_results[book_name].append(result_entry['result'])
|
808 |
+
|
809 |
+
# Filterung und Hinzufügen der Ergebnisse zu all_results
|
810 |
+
filtered_results = filter_and_format_results(
|
811 |
+
base_results, search_type, search_term, gematria_sum_search,
|
812 |
+
search_mode, date_str, name, initial_gematria_sum, sub_oscillation_level, base_results_list
|
813 |
+
)
|
814 |
+
all_results.extend(filtered_results)
|
815 |
+
|
816 |
+
# Übersetzung der Ergebnisse, falls angefordert
|
817 |
+
if translate_results:
|
818 |
+
for result_entry in all_results:
|
819 |
+
try:
|
820 |
+
text_to_translate = result_entry["result"]["result_text"]
|
821 |
+
source_lang = result_entry["result"].get("source_language", "auto")
|
822 |
+
translated_text = translation_utils.get_translation(text_to_translate, "en", source_lang)[0]
|
823 |
+
result_entry["result"]["translated_text"] = translated_text
|
824 |
+
except KeyError as e:
|
825 |
+
logger.error(f"KeyError translating result_text: {e}")
|
826 |
+
|
827 |
+
return all_results
|
828 |
+
|
829 |
+
# Hilfsfunktion zum Durchführen der ELS-Suche für eine gegebene Gematria-Summe
|
830 |
+
def perform_els_search_for_gematria_sum(gematria_sum, include_torah, include_bible, include_quran, include_hindu, include_tripitaka):
|
831 |
+
return perform_els_search(
|
832 |
+
step=gematria_sum,
|
833 |
+
rounds_combination="1,-1",
|
834 |
+
tlang="english",
|
835 |
+
strip_spaces=True,
|
836 |
+
strip_in_braces=True,
|
837 |
+
strip_diacritics_chk=True,
|
838 |
+
include_torah=include_torah,
|
839 |
+
include_bible=include_bible,
|
840 |
+
include_quran=include_quran,
|
841 |
+
include_hindu=include_hindu,
|
842 |
+
include_tripitaka=include_tripitaka
|
843 |
+
)
|
844 |
+
|
845 |
+
# Hilfsfunktion zum Filtern und Formatieren der Ergebnisse
|
846 |
+
def filter_and_format_results(results, search_type, search_term, gematria_sum_search, search_mode, date_str, name, initial_gematria_sum, sub_oscillation_level, base_results_list):
|
847 |
+
search_term=strip_diacritics(search_term)
|
848 |
+
filtered_results = []
|
849 |
+
for book_name, book_results in results.items():
|
850 |
+
if book_results:
|
851 |
+
for result in book_results:
|
852 |
+
try:
|
853 |
+
result_text = result['result_text']
|
854 |
+
result_sum = result['result_sum']
|
855 |
+
|
856 |
+
# Finde die verwendete Sub-Oszillation heraus
|
857 |
+
sub_oscillation_sums = []
|
858 |
+
current_gematria_sum = initial_gematria_sum
|
859 |
+
|
860 |
+
if sub_oscillation_level > 0:
|
861 |
+
for i in range(1, sub_oscillation_level + 1):
|
862 |
+
for base_result_entry_tuple in base_results_list:
|
863 |
+
base_result_entry = dict(base_result_entry_tuple)
|
864 |
+
if result.get('result_sum') == base_result_entry['result'].get('result_sum') and result.get('result_text') == base_result_entry['result'].get('result_text'):
|
865 |
+
sub_gematria_sum = base_result_entry.get('sub_gematria_sum')
|
866 |
+
if sub_gematria_sum:
|
867 |
+
sub_oscillation_sums.append(sub_gematria_sum)
|
868 |
+
current_gematria_sum += sub_gematria_sum
|
869 |
+
break # Innere Schleife beenden, da das passende Ergebnis gefunden wurde
|
870 |
+
else:
|
871 |
+
continue # Äußere Schleife fortsetzen, wenn kein passendes Ergebnis gefunden wurde
|
872 |
+
break
|
873 |
+
|
874 |
+
# Sub-Oszillation Summen an den Namen anhängen
|
875 |
+
sub_oscillation_text = ""
|
876 |
+
if sub_oscillation_sums:
|
877 |
+
sub_oscillation_text = " + " + " + ".join(map(str, sub_oscillation_sums))
|
878 |
+
|
879 |
+
# Filtern der Ergebnisse
|
880 |
+
if search_type == "Text in result_text":
|
881 |
+
if search_mode == "Exact Search" and search_term == result_text:
|
882 |
+
filtered_results.append(
|
883 |
+
{
|
884 |
+
"date": date_str,
|
885 |
+
"name": f"{name}{sub_oscillation_text}",
|
886 |
+
"gematria_sum": current_gematria_sum,
|
887 |
+
"book": book_name,
|
888 |
+
"result": result
|
889 |
+
}
|
890 |
+
)
|
891 |
+
elif search_mode == "Contains Word" and search_term in result_text:
|
892 |
+
filtered_results.append(
|
893 |
+
{
|
894 |
+
"date": date_str,
|
895 |
+
"name": f"{name}{sub_oscillation_text}",
|
896 |
+
"gematria_sum": current_gematria_sum,
|
897 |
+
"book": book_name,
|
898 |
+
"result": result
|
899 |
+
}
|
900 |
+
)
|
901 |
+
elif search_type == "Gematria Sum in results":
|
902 |
+
if result_sum == gematria_sum_search:
|
903 |
+
filtered_results.append(
|
904 |
+
{
|
905 |
+
"date": date_str,
|
906 |
+
"name": f"{name}{sub_oscillation_text}",
|
907 |
+
"gematria_sum": current_gematria_sum,
|
908 |
+
"book": book_name,
|
909 |
+
"result": result
|
910 |
+
}
|
911 |
+
)
|
912 |
+
except KeyError as e:
|
913 |
+
logger.error(f"KeyError - Key '{e.args[0]}' not found in result. Skipping this result.")
|
914 |
+
continue
|
915 |
+
return filtered_results
|
916 |
+
|
917 |
+
def perform_date_range_els_search(start_date, end_date, names_input, search_type, search_term, gematria_sum_search, search_mode, include_torah, include_bible, include_quran, include_hindu, include_tripitaka, translate_results, sub_oscillation_search, sub_oscillation_level):
|
918 |
names = [n.strip() for n in names_input.split("\n") if n.strip()]
|
919 |
date_gematrias = perform_gematria_calculation_for_date_range(start_date, end_date)
|
920 |
|
|
|
935 |
for intermediate_result in intermediate_results:
|
936 |
date_str = intermediate_result["date"]
|
937 |
name = intermediate_result["name"]
|
938 |
+
initial_gematria_sum = intermediate_result["gematria_sum"]
|
939 |
+
|
940 |
+
# Basis-Suche durchführen
|
941 |
+
base_results = perform_els_search_for_gematria_sum(
|
942 |
+
initial_gematria_sum, include_torah, include_bible, include_quran, include_hindu, include_tripitaka
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
943 |
)
|
944 |
|
945 |
+
# Nur ausgewählte Bücher für die Sub-Oszillationen-Suche berücksichtigen
|
946 |
+
selected_books_results = {}
|
947 |
+
if include_torah:
|
948 |
+
selected_books_results["Torah"] = base_results.get("Torah", [])
|
949 |
+
if include_bible:
|
950 |
+
selected_books_results["Bible"] = base_results.get("Bible", [])
|
951 |
+
if include_quran:
|
952 |
+
selected_books_results["Quran"] = base_results.get("Quran", [])
|
953 |
+
if include_hindu:
|
954 |
+
selected_books_results["Rig Veda"] = base_results.get("Rig Veda", [])
|
955 |
+
if include_tripitaka:
|
956 |
+
selected_books_results["Tripitaka"] = base_results.get("Tripitaka", [])
|
957 |
+
|
958 |
+
# Speichere die base_results in einer Liste von Tupeln
|
959 |
+
base_results_list = []
|
960 |
+
for book_name, book_results in selected_books_results.items():
|
961 |
+
for result in book_results:
|
962 |
+
base_results_list.append(tuple(sorted({'book': book_name, 'result': result}.items())))
|
963 |
+
|
964 |
+
# Sub-Oszillationen-Suche, falls aktiviert und Level > 0
|
965 |
+
if sub_oscillation_search and sub_oscillation_level > 0:
|
966 |
+
base_results_list = perform_sub_oscillation_search(
|
967 |
+
base_results_list, initial_gematria_sum, sub_oscillation_level,
|
968 |
+
include_torah, include_bible, include_quran, include_hindu, include_tripitaka
|
969 |
+
)
|
970 |
+
|
971 |
+
# Umwandlung der erweiterten base_results_list in base_results
|
972 |
+
base_results = {}
|
973 |
+
for result_entry_tuple in base_results_list:
|
974 |
+
result_entry = dict(result_entry_tuple) # Konvertiere zurück zu Dictionary
|
975 |
+
book_name = result_entry['book']
|
976 |
+
if book_name not in base_results:
|
977 |
+
base_results[book_name] = []
|
978 |
+
base_results[book_name].append(result_entry['result'])
|
979 |
+
|
980 |
+
# Filterung und Hinzufügen der Ergebnisse zu all_results
|
981 |
+
filtered_results = filter_and_format_results(
|
982 |
+
base_results, search_type, search_term, gematria_sum_search,
|
983 |
+
search_mode, date_str, name, initial_gematria_sum, sub_oscillation_level, base_results_list
|
984 |
+
)
|
985 |
+
all_results.extend(filtered_results)
|
|
|
|
|
|
|
986 |
|
987 |
# Übersetzung der Ergebnisse, falls angefordert
|
988 |
if translate_results:
|
|
|
990 |
try:
|
991 |
text_to_translate = result_entry["result"]["result_text"]
|
992 |
source_lang = result_entry["result"].get("source_language", "auto")
|
993 |
+
translated_text = translation_utils.get_translation(text_to_translate, "en", source_lang)[0]
|
994 |
+
result_entry["result"]["translated_text"] = translated_text
|
995 |
except KeyError as e:
|
996 |
logger.error(f"KeyError translating result_text: {e}")
|
997 |
|
998 |
return all_results
|
999 |
|
1000 |
+
def remove_duplicates(dict_list):
|
1001 |
+
"""
|
1002 |
+
Entfernt Duplikate aus dict_list, basierend auf einer ID (repr).
|
1003 |
+
dict_list: Liste aus Dictionaries (oder Tupeln),
|
1004 |
+
in denen wir Duplikate filtern wollen.
|
1005 |
+
"""
|
1006 |
+
seen = set()
|
1007 |
+
unique_list = []
|
1008 |
+
for item in dict_list:
|
1009 |
+
# Hier legen wir fest, was item sein kann:
|
1010 |
+
# - typischerweise ein dict: {'book':..., 'result':...}
|
1011 |
+
# - oder ein tuple, das wir ggf. in dict umwandeln
|
1012 |
+
|
1013 |
+
# Mache item zu einem Dictionary, falls es ein tuple ist
|
1014 |
+
if isinstance(item, tuple):
|
1015 |
+
item = dict(item)
|
1016 |
+
# => Jetzt haben wir item als Dictionary
|
1017 |
+
|
1018 |
+
# Erstelle eine ID; repr(item) enthält Keys und Values
|
1019 |
+
# Wenn du es feingranular willst, kannst du stattdessen
|
1020 |
+
# nur bestimmte Felder rausziehen, z.B. (book, result_sum, result_text)
|
1021 |
+
item_id = repr(item)
|
1022 |
+
|
1023 |
+
if item_id not in seen:
|
1024 |
+
seen.add(item_id)
|
1025 |
+
unique_list.append(item)
|
1026 |
+
|
1027 |
+
return unique_list
|
1028 |
+
|
1029 |
+
|
1030 |
+
def perform_sub_oscillation_search(base_results_list, initial_gematria_sum, level,
|
1031 |
+
include_torah, include_bible, include_quran,
|
1032 |
+
include_hindu, include_tripitaka):
|
1033 |
+
"""
|
1034 |
+
Führt 'level' Sub-Oszillationsrunden durch und
|
1035 |
+
hängt neu entstehende Ergebnisse an base_results_list an.
|
1036 |
+
Verwendet remove_duplicates, um Dopplungen zu vermeiden.
|
1037 |
+
"""
|
1038 |
+
if level == 0:
|
1039 |
+
return base_results_list
|
1040 |
+
|
1041 |
+
# Mache base_results_list komplett zu Dicts
|
1042 |
+
# (falls es Tupel gibt, wandeln wir die hier in Dicts):
|
1043 |
+
dict_list = []
|
1044 |
+
for entry in base_results_list:
|
1045 |
+
if isinstance(entry, tuple):
|
1046 |
+
dict_list.append(dict(entry))
|
1047 |
+
elif isinstance(entry, dict):
|
1048 |
+
dict_list.append(entry)
|
1049 |
+
else:
|
1050 |
+
dict_list.append({"unknown": entry})
|
1051 |
+
|
1052 |
+
new_results = []
|
1053 |
+
# Erzeuge in diesem Durchgang neue Einträge
|
1054 |
+
for base_entry in dict_list:
|
1055 |
+
sub_gematria_sum = base_entry['result']['result_sum']
|
1056 |
+
combined_sub_gematria_sum = initial_gematria_sum + sub_gematria_sum
|
1057 |
+
|
1058 |
+
sub_results = perform_els_search_for_gematria_sum(
|
1059 |
+
combined_sub_gematria_sum,
|
1060 |
+
include_torah, include_bible, include_quran, include_hindu, include_tripitaka
|
1061 |
+
)
|
1062 |
+
|
1063 |
+
# Für jedes gefundene sub_result => new_entry
|
1064 |
+
for book_name, book_list in sub_results.items():
|
1065 |
+
for res in book_list:
|
1066 |
+
new_entry = {
|
1067 |
+
'book': book_name,
|
1068 |
+
'result': res,
|
1069 |
+
# speichere optional sub_gematria_sum
|
1070 |
+
'sub_gematria_sum': sub_gematria_sum
|
1071 |
+
}
|
1072 |
+
new_results.append(new_entry)
|
1073 |
+
|
1074 |
+
# Kombiniere Originaldaten + neue Daten
|
1075 |
+
combined = dict_list + new_results
|
1076 |
+
|
1077 |
+
# Entferne Duplikate
|
1078 |
+
combined_no_dupes = remove_duplicates(combined)
|
1079 |
+
|
1080 |
+
# Rekursion: ein Level tiefer
|
1081 |
+
return perform_sub_oscillation_search(
|
1082 |
+
combined_no_dupes,
|
1083 |
+
initial_gematria_sum,
|
1084 |
+
level - 1,
|
1085 |
+
include_torah,
|
1086 |
+
include_bible,
|
1087 |
+
include_quran,
|
1088 |
+
include_hindu,
|
1089 |
+
include_tripitaka
|
1090 |
+
)
|
1091 |
+
|
1092 |
perform_search_btn_els.click(
|
1093 |
perform_date_range_els_search,
|
1094 |
+
inputs=[start_date_els, end_date_els, names_input_els, search_type_els, search_term_els, gematria_sum_search_els, search_mode_els, include_torah_chk_els, include_bible_chk_els, include_quran_chk_els, include_hindu_chk_els, include_tripitaka_chk_els, translate_results_chk_els, sub_oscillation_search_chk_els, sub_oscillation_level_els],
|
1095 |
outputs=[filtered_results_output_els]
|
1096 |
)
|
1097 |
|
1098 |
+
|
1099 |
+
|
1100 |
# --- Event Handlers ---
|
1101 |
|
1102 |
search_type.change(
|
gematria.py
CHANGED
@@ -12,8 +12,8 @@ def strip_diacritics(text):
|
|
12 |
for char in unicodedata.normalize('NFD', text):
|
13 |
if unicodedata.category(char) not in ['Mn', 'Cf']:
|
14 |
stripped_text += char
|
15 |
-
else:
|
16 |
-
logger.debug(f"Info: Diakritisches Zeichen '{char}' wird ignoriert.")
|
17 |
return stripped_text
|
18 |
|
19 |
def letter_to_value(letter):
|
@@ -150,7 +150,7 @@ def letter_to_value(letter):
|
|
150 |
return 0
|
151 |
else:
|
152 |
# Gib eine spezifische Warnung aus, wenn das Zeichen unbekannt ist
|
153 |
-
logger.debug(f"Warnung: Unbekanntes Zeichen '{letter}' ignoriert.")
|
154 |
return 0
|
155 |
|
156 |
|
|
|
12 |
for char in unicodedata.normalize('NFD', text):
|
13 |
if unicodedata.category(char) not in ['Mn', 'Cf']:
|
14 |
stripped_text += char
|
15 |
+
#else:
|
16 |
+
#logger.debug(f"Info: Diakritisches Zeichen '{char}' wird ignoriert.")
|
17 |
return stripped_text
|
18 |
|
19 |
def letter_to_value(letter):
|
|
|
150 |
return 0
|
151 |
else:
|
152 |
# Gib eine spezifische Warnung aus, wenn das Zeichen unbekannt ist
|
153 |
+
#logger.debug(f"Warnung: Unbekanntes Zeichen '{letter}' ignoriert.")
|
154 |
return 0
|
155 |
|
156 |
|