如何通过 also-see 和 similar-to 关系获取与参考同义词集相关的同义词集? (Python NLTK)

How can I get synsets related to a reference synset via also-see and similar-to relations? (Python NLTK)

以下代码使用种子肯定词并将其所有同义词成员(引理)添加到列表中。

from nltk.corpus import wordnet as wn

def pos_expansion():

pos_list = ['good'] #positive seed list
lemmas = [] #list of lemmas
unique_lemmas = []

for pos_word in pos_list:
    for synset in wn.synsets(pos_word):
        if synset.pos() in ['a', 's']: #restrict synsets to adjectives only
            lemmas = lemmas + synset.lemma_names() #add all synonyms (lemmas) within each synset of pos_word

print(lemmas)

pos_expansion()

我想做同样的事情,但使用同义词集。我想 return 基于 NLTK 的 WordNet 中的同见、相似和属性关系的实际同义词集列表(假设种子同义词集是 'good.a.01')。这可能吗?提前致谢。

同义词集与 WN 中的各个术语有不同的关系。所需的同义词集关系如下:

    for i in wn.all_synsets():
        print(i._related('n'))
        print(i.also_sees())
        print(i.similar_tos())