【发布时间】:2014-08-03 06:50:01
【问题描述】:
我想在 Python 中执行以下操作(我有 NLTK 库,但我对 Python 不是很好,所以我用一个奇怪的伪代码编写了以下内容):
from nltk.corpus import wordnet as wn #Import the WordNet library
for each adjective as adj in wn #Get all adjectives from the wordnet dictionary
print adj & antonym #List all antonyms for each adjective
once list is complete then export to txt file
这样我就可以生成一个完整的形容词反义词词典。我认为它应该是可行的,但我不知道如何创建 Python 脚本。我想用 Python 来做,因为那是 NLTK 的母语。
【问题讨论】:
-
1. from nltk.corpus import wordnet as wn '导入 wordnet 库 2. for each adjective as adj in wn '从 wordnet 字典中获取所有形容词 3.print adj & antonym '列出每个形容词的所有反义词 4.once list is complete then导出为txt文件
-
在 wordnet 中列出反义词并不是那么简单,因为选择了超下位词通过同义词集链接,反义词通过引理链接。