I have a problem to print an Arabic text in Python, I write a code with convert English characters into Arabic ones as is called (chat language or Franco Arabic) and then create a combination between different results to get suggestions based on user input.
def transliterate(francosentence, verbose=False):
francowords = francosentence.split()
arabicconvertedwords = []
for i in francowords:
rankeddata=[]
rankeddata=transliterate_word(i)
arabicconvertedwords.append(rankeddata)
for index in range(len(rankeddata)):
print rankeddata[index]
ran=list(itertools.product(*arabicconvertedwords))
for I in range(len(ran)):
print ran[I]
The first print (print rankeddata[index]) gives Arabic words, but after the combination process is executed the second print (print ran[I]) gives something like that: (u'\u0627\u0646\u0647', u'\u0631\u0627\u064a\u062d', u'\u0627\u0644\u062c\u0627\u0645\u0639\u0647')
How can I print Arabic words?
انه رايح الجامعه. I believe your input to this was "I am going to the university" or along the lines of that, correct? Which would indicate that your code actually does work. - idjaw