Search code examples
python-2.7nltkarabiccorpusstop-words

How can I make the output appear in Arabic language when i import stopWords corpus in python2.7?


i use python 2.7 and the code as shown here

    from nltk.corpus import stopwords
    sW_list=stopwords.words('arabic')
    print (sW_list)

and the output was :

    [u'\u0625\u0630', u'\u0625\u0630\u0627', u'\u0625\u0630\u0645\u0627' ...... 

Solution

  • Printing a list uses the repr of the list elements.

    sW_list = [u'\u0625\u0630', u'\u0625\u0630\u0627', u'\u0625\u0630\u0645\u0627' ]
    print(' '.join(sW_list))
    

    produces

    إذ إذا إذم