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', ...]