[英]How to get Only Part of speech From POS_TAG in python
Hi every body I wan to get Pos_tag only like "jj" etc of a word . 大家好,我想得到Pos_tag就像一个单词的“ jj”等。 how to get this from list of post_tag .
如何从post_tag列表中获取此信息。 I am able to print this result :
我可以打印此结果:
list1=nltk.pos_tag(words)
print(list1)
>>[('good', 'JJ')]
Now My question is now to separate word and post tag from the above result list. 现在,我的问题是从上述结果列表中分离单词和帖子标签。 I want to store word in myword variable and jj to mypos variable Please store good and jj into two different variable and print separate
我想将单词存储在myword变量中,并将jj 存储到mypos变量中。 请将good和jj存储到两个不同的变量中,并分别打印
I think you need this: 我认为您需要这样做:
myword = list[0][0]
mypos = list[0][1]
Output: 输出:
good
JJ
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.