hebrew.py

Created by wperez274

Created on December 07, 2023

1.71 KB


def transliterate_to_hebrew(english_text, transliteration_dict):
    hebrew_text = ''.join(transliteration_dict.get(char.lower(), char) for char in english_text)
    return hebrew_text

def generate_common_hebrew_words():
    common_hebrew_words = {
        'hello': 'shalom',
        'goodbye': 'lehitraot',
        'please': 'bevakasha',
        'thank you': 'todah rabah',
        'yes': 'ken',
        'no': 'lo',
        'sorry': 'slicha',
        'excuse me': 'slicha',
        'friend': 'chaver',
        'family': 'mishpacha',
        'love': 'ahava',
        'peace': 'shalom',
        'good morning': 'boker tov',
        'good afternoon': 'tsohorayim tovim',
        'good evening': 'erev tov',
        'good night': 'laila tov',
        'how are you?': 'ma shlomcha?',
        'I\'m fine': 'ani beseder',
        'what is your name?': 'ma shimcha?',
        'my name is': 'shmi',
        'where is': 'eifo',
        'what time is it?': 'ma ha'sha\'a?',
        'today': 'hayom',
        'tomorrow': 'machar',
        'yesterday': 'etmol',
        'water': 'mayim',
        'food': 'ochel',
        'thank you very much': 'todah rabah meod',
        'sorry, I don\'t understand': 'slicha, ani lo mevin',
        'please speak more slowly': 'bevakasha, dabri yoter leat'
        # Add more common words here
    }
    return common_hebrew_words

def main():
    transliteration_dict = generate_common_hebrew_words()

    # Get input from the user
    english_input = input("Enter an English word or sentence: ")

    # Transliterate and print the result
    hebrew_output = transliterate_to_hebrew(english_input, transliteration_dict)
    print("Hebrew Equivalent:", hebrew_output)

if __name__ == "__main__":
    main()

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.