Python 3.x 从一个单词中获取所有可能的pos标记

Python 3.x 从一个单词中获取所有可能的pos标记,python-3.x,nlp,nltk,Python 3.x,Nlp,Nltk,我目前正在尝试使用Python获取单个单词的所有可能的pos标记。 从传统的pos标记器中,如果您输入单个单词,您只能返回一个标记。 有没有办法得到所有可能的东西? 是否可以在语料库(如brown)中搜索特定单词而不仅仅是类别 亲切问候并感谢您的帮助您可以使用此方法获得pos_标签(),特别是针对brown import nltk from nltk.corpus import brown from collections import Counter, defaultdict # x is

我目前正在尝试使用Python获取单个单词的所有可能的pos标记。 从传统的pos标记器中,如果您输入单个单词,您只能返回一个标记。 有没有办法得到所有可能的东西? 是否可以在语料库(如brown)中搜索特定单词而不仅仅是类别


亲切问候并感谢您的帮助

您可以使用此方法获得
pos_标签()
,特别是针对
brown

import nltk
from nltk.corpus import brown
from collections import Counter, defaultdict

# x is a dict which will have the word as key and pos tags as values 
x = defaultdict(list)

# looping for first 100 words and its pos tags
for word, pos in brown.tagged_words()[1:100]:
    if pos not in x[word]:        # to append one tag only once
        x[word].append(pos)       # adding key-value to x

# to print the pos tags for the word 'further'
print(x['further'])
#['RBR']