From fed3a8f082d40afad604e49f80b95a8562bfa83d Mon Sep 17 00:00:00 2001 From: Yair Date: Sun, 7 Jan 2024 10:38:46 +0000 Subject: [PATCH] added letters --- txt.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/txt.py b/txt.py index 6fab9cf..deed706 100644 --- a/txt.py +++ b/txt.py @@ -38,11 +38,14 @@ def map_to_keyboard_hebrew(input_text): 'f': 'כ', 'k': 'ל', 'n': 'מ', + 'o': 'ם', 'b': 'נ', + 'i': 'ן', 'x': 'ס', 'g': 'ע', 'p': 'פ', 'm': 'צ', + '.': 'ץ', 'e': 'ק', 'r': 'ר', 'a': 'ש', @@ -50,6 +53,8 @@ def map_to_keyboard_hebrew(input_text): ';': 'ף', 'i': 'ן', 'l': 'ך', + '/': '.', + '\/': ',' # Add any other characters you want to map } @@ -58,23 +63,27 @@ def map_to_keyboard_hebrew(input_text): def rtl_text_wrap(text, width): words = text.split() + # Reverse the order of words for RTL language + words = words[::-1] + lines = [] current_line = [] current_line_length = 0 - for word in reversed(words): # Reverse words for RTL + for word in words: # No need to reverse the words list again if current_line_length + len(word) <= width: current_line.append(word) current_line_length += len(word) + 1 # +1 for the space else: - lines.append(' '.join(reversed(current_line))) # Reverse back to original + lines.append(' '.join(current_line)) current_line = [word] - current_line_length = len(word) + 1 # +1 for the space + current_line_length = len(word) + 1 - lines.append(' '.join(reversed(current_line))) # Add the last line + lines.append(' '.join(current_line)) # Add the last line return '\n'.join(lines) + while True: user_input = input("Type something (or press Enter to generate image): ") logging.info(f"User input: {user_input}")