Dear Tutors,<br>I&#39;m trying to get the most frequent words in an Arabic text. I wrote the following code and tried it on English and it works fine, but when I try it on Arabic, all I get is the slashes and x&#39;s. I&#39;m not familiar with Unicode. Could somebody please tell me what&#39;s wrong here, and how I can get the actual Arabic words?<br>
Thank you in anticipation<br><br><br>import codecs<br>infile = codecs.open(r&#39;C:\Documents and Settings\Emad\Desktop\milal.txt&#39;, &#39;r&#39;, &#39;utf-8&#39;).read().split()<br>num = {}<br>for word in infile:<br>&nbsp;&nbsp;&nbsp; if word not in num:<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; num[word] = 1<br>&nbsp;&nbsp;&nbsp; num[word] +=1<br>new = zip(num.values(), num.keys())<br>new.sort()<br>new.reverse()<br>outfile = codecs.open(r&#39;C:\Documents and Settings\Emad\Desktop\milalwanihal.txt&#39;, &#39;w&#39;, &#39;utf-8&#39;)<br>
for word in new:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print &gt;&gt; out, word<br>out.close()<br><br clear="all"><br>-- <br>لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد الغزالي<br>&quot;No victim has ever been more repressed and alienated than the truth&quot;<br>
<br>Emad Soliman Nawfal<br>Indiana University, Bloomington<br><a href="http://emnawfal.googlepages.com">http://emnawfal.googlepages.com</a><br>--------------------------------------------------------