Hello,
I’m trying to create an experiment in the Hebrew language, which requires participants input words through the keyboard. In order to do that, I created a dictionary that translates English to Hebrew. However, while it works fine for letters, it cannot translate punctuation, regardless of the language.
Here is the dictionary I created:
eng_to_heb = {'a' : u'ש', 'b' : u'נ', 'c' : u'ב', 'd' : u'ג',
'e' : u'ק', 'f' : u'כ' , 'g' : u'ע' , 'h' : u'י', 'i' : u'ן',
'j' : u'ח', 'k' : u'ל', 'l' : u'ך', 'm' : u'צ' , 'n' : u'מ',
'o' : u'ם', 'p' : u'פ', 'q' : u'/', 'r' : u'ר', 's' : u'ד',
't' : u'א', 'u' : u'ו', 'v': u'ה',
'w' : u"'", 'x' : u'ס', 'y' : u'ט',
'z' : u'ז', 'slash' : u".", "comma" : u"ת", u'ת':u'ת',
"semicolon" : u'ף', 'period' : u'ץ' , 'aspostrophe' : u',',
'space' : ' '}
And the code to input the words:
if charsEntered != []:
if event.getKeys(keyList = ["backspace"]):
charsEntered.pop()
#get new chars entered
newChars = event.getKeys(keyList = list(string.ascii_letters))
if newChars:
for each in newChars:
print(each)
charsEntered.append(eng_to_heb[each])
#include new chars in list
#charsEntered.extend([for i in newChars: eng_to_heb[i] ] )
#create string out of list
thirdWordString = "".join(charsEntered)[::-1]
Does anyone faced a similar problem? or have a solution?
Thanks in advance,
Jozeph