我如何转换
[Synset('dog.n.01'), Synset('frump.n.01'), Synset('dog.n.03'), Synset('cad.n.01'), Synset('frank.n.02'), Synset('pawl.n.01'), Synset('andiron.n.01'), Synset('chase.v.01')]
到
'dog.n.01', 'frump.n.01', 'dog.n.03', 'cad.n.01', 'frank.n.02', 'pawl.n.01', 'andriron.n.01', 'chase.v.01'
在python中
请注意原始文本是来自NLTK库的wordnet.synsets('dog')的输出
提前致谢
答案 0 :(得分:2)
我认为这些数据来自NLTK?
from nltk.corpus import wordnet as wn
syns = wn.synsets('dog')
如果是,请尝试:
names = [ s.name() for s in syns ]
获取名称列表。
(将来,请提供有关数据来源的更多背景信息。)