import json
# Implementemos la función de temurah con el alfabeto completo y probemos la conversión de "Baphomet" a "Sofia"
# en hebreo usando temurah. 
# Nota: La representación exacta de "Baphomet" y "Sofia" en hebreo puede variar debido a interpretaciones,
# pero aquí usaremos transliteraciones aproximadas para ilustrar cómo podría hacerse.

def temurah(text, hebrew_alphabet='אבגדהוזחטיכלמנסעפצקרשת', reverse=True):
    """
    Aplica la temurah a un texto hebreo utilizando todo el alfabeto hebreo.
    El esquema de ejemplo simplemente invierte el orden del alfabeto.
    """
    # Invertir el alfabeto si se solicita
    if reverse:
        hebrew_alphabet = hebrew_alphabet[::-1]

    # Generar el alfabeto invertido
    inverted_alphabet = hebrew_alphabet[::-1]
    
    # Crear el diccionario de mapeo para temurah
    temurah_mapping = {orig: inv for orig, inv in zip(hebrew_alphabet, inverted_alphabet)}
    
    # Aplicar temurah al texto
    temurah_text = ''.join(temurah_mapping.get(char, char) for char in text)
    
    return temurah_text

# Definir el alfabeto hebreo
hebrew_alphabet = 'אבגדהוזחטיכלמנסעפצקרשת'

latin_alphabet = 'abcdefghijklmnopqrstuvwxyz'


def temura_conv(txt,lang):
    if lang=="Hebrew":
        alphabet = hebrew_alphabet
    elif lang=="Latin":
        alphabet= latin_alphabet
    else:
        alphabet=latin_alphabet
    
    res = temurah(txt,alphabet)
    
    # Aplicar temurah al texto hipotético de "Baphomet"
    return res