简体   繁体   English

如何在NLTK的印度语料库中打印印地语单词?

[英]How to print Hindi words in NLTK's Indian corpus?

Code: 码:

from nltk.corpus import indian

nltk.corpus.indian.words('hindi.pos')

Output: 输出:

[u'\u092a\u0942\u0930\u094d\u0923', u'\u092a\u094d\u0930\u0924\u093f\u092c\u0902\u0927', ...]

But, I need output to be: ['पूर्ण', 'प्रतिबंध', 'हटाओ', ':', 'इराक', 'संयुक्त', ...] Like shown in: http://www.nltk.org/book/ch02.html 但是,我需要输出: ['पूर्ण', 'प्रतिबंध', 'हटाओ', ':', 'इराक', 'संयुक्त', ...]如下所示: http['पूर्ण', 'प्रतिबंध', 'हटाओ', ':', 'इराक', 'संयुक्त', ...] /book/ch02.html

Could you please tell how can I print the actual words instead of unicode. 您能否告诉我如何打印实际的单词而不是unicode。 Any help is appreciated. 任何帮助表示赞赏。

Python 2 doesn't have VM-wide Unicode support. Python 2没有VM范围的Unicode支持。 The prettyprinter isn't the same as printing one of the strings in the array -- but printing just one will work as expected. prettyprinter与打印数组中的一个字符串不同 - 但只打印一个将按预期工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM