Spaces:
Sleeping
Sleeping
Commit
·
28c065d
1
Parent(s):
7445a27
order results by book
Browse files
app.py
CHANGED
@@ -113,6 +113,9 @@ def gematria_search_interface(phrase):
|
|
113 |
if not matching_phrases:
|
114 |
return "No matching phrases found.", "\n".join(debug_output)
|
115 |
|
|
|
|
|
|
|
116 |
phrases = [match[0] for match in matching_phrases]
|
117 |
debug_callback(f"Debug: Phrases to be translated: {phrases}")
|
118 |
translations = translate_phrases(phrases)
|
@@ -120,10 +123,10 @@ def gematria_search_interface(phrase):
|
|
120 |
|
121 |
result = "Matching phrases:\n"
|
122 |
for match, translation in zip(matching_phrases, translations):
|
123 |
-
if len(match)
|
124 |
debug_callback(f"Error: Expected tuple of length 5, but got {len(match)}: {match}")
|
125 |
continue
|
126 |
-
result += f"Book: {match[2]} ({match[3]})\nChapter: {match[
|
127 |
|
128 |
return result, "\n".join(debug_output)
|
129 |
|
|
|
113 |
if not matching_phrases:
|
114 |
return "No matching phrases found.", "\n".join(debug_output)
|
115 |
|
116 |
+
# Sort matching phrases by book, chapter, and verse
|
117 |
+
matching_phrases.sort(key=lambda x: (x[1], x[3], x[4]))
|
118 |
+
|
119 |
phrases = [match[0] for match in matching_phrases]
|
120 |
debug_callback(f"Debug: Phrases to be translated: {phrases}")
|
121 |
translations = translate_phrases(phrases)
|
|
|
123 |
|
124 |
result = "Matching phrases:\n"
|
125 |
for match, translation in zip(matching_phrases, translations):
|
126 |
+
if len(match) != 5:
|
127 |
debug_callback(f"Error: Expected tuple of length 5, but got {len(match)}: {match}")
|
128 |
continue
|
129 |
+
result += f"Book: {match[2]} ({match[3]})\nChapter: {match[3]}, Verse: {match[4]}\nPhrase: {match[0]}\nTranslation: {translation}\n\n"
|
130 |
|
131 |
return result, "\n".join(debug_output)
|
132 |
|