我如何在我的python代码中输入阿拉伯文本? [英] How do i input Arabic text into my python code?

查看:176
本文介绍了我如何在我的python代码中输入阿拉伯文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的项目是用阿拉伯语来识别一个积极或消极的情绪(情绪分析),为了做这个任务,我使用NLTK和python,当我在阿拉伯语中输入tweets时出现错误

my project is to identify a sentiment either positive or negative ( sentiment analysis ) in Arabic language,to do this task I used NLTK and python, when I enter tweets in arabic an error occurs

>>> pos_tweets = [(' أساند كل عون أمن شريف', 'positive'),
              ('ما أحلى الثورة التونسية', 'positive'),
              ('أجمل طفل في العالم', 'positive'),
              ('الشعب يحرس', 'positive'),
              ('ثورة شعبنا هي ثورة الكـــرامة وثـــورة الأحــــرار', 'positive')]
Unsupported characters in input

我如何解决这个问题?

推荐答案

你的问题来自IDLE shell。 AFAIK IDLE将不会以交互模式接受UTF-8输入。

Your problem came from the IDLE shell. AFAIK IDLE won't accept UTF-8 input in interactive mode.

我建议您使用替代(更好)的shell,例如 DreamPie PythonWin

I suggest youe use alternative (and better) shells such as DreamPie or PythonWin.

这篇关于我如何在我的python代码中输入阿拉伯文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆