Spaces:
Configuration error
Configuration error
Create sloka_processor.py: Simplifying Slokas/Stotras
Browse files
sloka_processor.py: Simplifying Slokas/Stotras
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Pre-defined dictionary for symbolic meanings
|
| 2 |
+
meanings = {
|
| 3 |
+
"Black Hole": "Represents destruction and collapse.",
|
| 4 |
+
"Wormhole": "A cosmic pathway connecting dimensions.",
|
| 5 |
+
"Singularity": "The center of infinite transformation and balance.",
|
| 6 |
+
"White Hole": "Represents creation and emergence of new dimensions.",
|
| 7 |
+
"Moon": "Symbolizes tranquility and the cyclical nature of time.",
|
| 8 |
+
"Sun": "Represents energy and cosmic balance.",
|
| 9 |
+
"Ashes": "Symbolizes purification and renunciation.",
|
| 10 |
+
"Snake Garland": "Represents immortality and the passage of time.",
|
| 11 |
+
"108": "Denotes cosmic distances and spiritual significance.",
|
| 12 |
+
"Trimurti": "Represents the forces of creation, sustenance, and destruction.",
|
| 13 |
+
}
|
| 14 |
+
|
| 15 |
+
def simplify_sloka(sloka):
|
| 16 |
+
"""
|
| 17 |
+
Simplifies a given sloka/stotra by extracting symbols and providing meanings.
|
| 18 |
+
"""
|
| 19 |
+
# Extract known symbols from the sloka
|
| 20 |
+
extracted_symbols = [word for word in meanings.keys() if word in sloka]
|
| 21 |
+
|
| 22 |
+
if not extracted_symbols:
|
| 23 |
+
return "No known symbols found in the input sloka.", {}
|
| 24 |
+
|
| 25 |
+
# Create simplified meanings
|
| 26 |
+
simplified_meanings = {symbol: meanings[symbol] for symbol in extracted_symbols}
|
| 27 |
+
return "Simplified meanings extracted successfully.", simplified_meanings
|