import nltk import json nltk.download('wordnet') from nltk.corpus import wordnet # 获取常用单词列表 common_words = list(wordnet.words()) # 选择前2000个常用单词 # word_list = common_words[:2000] # 转换为 JSON 格式 json_data = json.dumps(common_words) # 将数据写入 JSON 文件 with open('common_words.json', 'w') as file: file.write(json_data)