Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在NLTK'中打印印地语单词;印度语料库?_Python_Unicode_Nlp_Nltk - Fatal编程技术网

Python 如何在NLTK'中打印印地语单词;印度语料库?

Python 如何在NLTK'中打印印地语单词;印度语料库?,python,unicode,nlp,nltk,Python,Unicode,Nlp,Nltk,代码: 输出: from nltk.corpus import indian nltk.corpus.indian.words('hindi.pos') 但是,我需要输出为:['पूर्ण', 'प्रतिबंध', 'हटाओ', ':', 'इराक', 'संयुक्त', ...] 如图所示: 您能告诉我如何打印实际单词而不是unicode吗。 非常感谢您的帮助。Python 2不支持VM范围的Unicode。预打印器与打印数组中的一个字符串不同,但只打印一个字符串将按预期工作。Py

代码:

输出:

from nltk.corpus import indian

nltk.corpus.indian.words('hindi.pos')
但是,我需要输出为:
['पूर्ण', 'प्रतिबंध', 'हटाओ', ':', 'इराक', 'संयुक्त', ...]
如图所示:

您能告诉我如何打印实际单词而不是unicode吗。
非常感谢您的帮助。

Python 2不支持VM范围的Unicode。预打印器与打印数组中的一个字符串不同,但只打印一个字符串将按预期工作。

Python 2不支持VM范围的Unicode。预打印器与打印数组中的一个字符串不同,但可以打印只有一个可以按预期工作。

似乎这是Py2K,默认情况下没有unicode文本(尝试打印这些字符串),当我使用print nltk.corpus.indian.words('hindi.pos')时,输出是一样的。如果只打印一个呢?非常感谢。我现在可以打印了。尝试
print nltk.corpus.indian.words('hindi.pos'))
这似乎是Py2K,默认情况下没有unicode文本(尝试打印那些字符串),当我使用print nltk.corpus.indian.words('hindi.pos')时,输出是一样的。如果只打印一个呢?非常感谢。我现在可以打印了。尝试
print nltk.corpus.indian.words('hindi.pos')
[u'\u092a\u0942\u0930\u094d\u0923', u'\u092a\u094d\u0930\u0924\u093f\u092c\u0902\u0927', ...]