When using nltk package to tokenize Arabic text, the results appear as numbers! There is no problem when tokenizing English text.
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd8 in position 0: ordinal not in range(128)
# -*- coding: utf-8 -*-
import nltk
from nltk.tokenize import word_tokenize
import stop_words
from stop_words import get_stop_words
doc_a = "ذهب محمد الى المدرسه على دراجته. هذا اول يوم له في المدرسة"
sw = get_stop_words('ar')
tokens = nltk.word_tokenize(doc_a)
stopped_tokens = [i for i in tokens if not i in sw]
print(stopped_tokens)
When set tokens = nltk.word_tokenize(unicode(doc_a,"utf-8"))
Result:
[u'\u0630\u0647\u0628', u'\u0645\u062d\u0645\u062f', u'\u0627\u0644\u0645\u062f\u0631\u0633\u0647', u'\u062f\u0631\u0627\u062c\u062a\u0647', u'.', u'\u0627\u0644\u0645\u062f\u0631\u0633\u0629']