| import json |
| |
| |
|
|
| def notarikon(text, mode='first'): |
| """ |
| Genera un Notarikon de un texto hebreo. Por defecto, toma la primera letra de cada palabra. |
| Si se especifica otro modo, puede adaptarse para tomar letras seg煤n necesidades espec铆ficas. |
| |
| Args: |
| text (str): Texto hebreo del cual generar el Notarikon. |
| mode (str): Modo de generaci贸n del Notarikon ('first' para la primera letra, 'last' para la 煤ltima, etc.) |
| |
| Returns: |
| str: El Notarikon generado del texto. |
| """ |
| words = text.split() |
| if mode == 'first': |
| |
| notarikon_result = ''.join(word[0] for word in words if word) |
| elif mode == 'last': |
| |
| notarikon_result = ''.join(word[-1] for word in words if word) |
| else: |
| |
| notarikon_result = text |
| |
| return notarikon_result |
|
|
|
|
|
|
| """ |
| # Ejemplo de uso |
| #genesis = open("genesis.json","rb").read() |
| genesis = json.loads(open("genesis.json","r").read())["text"][0] |
| |
| ##example_text = "讘专讗砖讬转 讘专讗 讗诇讛讬诐 讗转 讛砖诪讬诐 讜讗转 讛讗专抓" # "En el principio Dios cre贸 los cielos y la tierra." |
| for txt in genesis: |
| |
| notarikon_result_first = notarikon(txt, mode='first') |
| notarikon_result_last = notarikon(txt, mode='last') |
| |
| print(notarikon_result_first, notarikon_result_last) |
| """ |
|
|