Tokenization of Arabic words using NLTK

后端 未结 2 1275
栀梦
栀梦 2020-12-28 16:36

I\'m using NLTK word_tokenizer to split a sentence into words.

I want to tokenize this sentence:

في_بيتنا كل شي لما تحت         


        
相关标签:
2条回答
  • 2020-12-28 16:43

    I always recommend using nltk.tokenize.wordpunct_tokenize. You can try out many of the NLTK tokenizers at http://text-processing.com/demo/tokenize/ and see for yourself.

    0 讨论(0)
  • 2020-12-28 16:52

    this is the output i get with my code, but i recall unicode doesn't go well in python 2 and I used 3.5

    nltk.word_tokenize('في_بيتنا كل شي لما تحتاجه يضيع ...ادور على شاحن فجأة يختفي ..لدرجة اني اسوي نفسي ادور شيء ')
    

    ['في_بيتنا', 'كل', 'شي', 'لما', 'تحتاجه', 'يضيع', '...', 'ادور', 'على', 'شاحن', 'فجأة', 'يختفي', '..لدرجة', 'اني', 'اسوي', 'نفسي', 'ادور', 'شيء']

    0 讨论(0)
提交回复
热议问题